From: Tang Bin Date: Tue, 24 May 2022 12:31:51 +0000 (+0800) Subject: opp: Fix error check in dev_pm_opp_attach_genpd() X-Git-Tag: v6.6.17~6834^2~1^2^2~42 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ea9496cbc959eb5c78f3e379199aca9ef4e386b;p=platform%2Fkernel%2Flinux-rpi.git opp: Fix error check in dev_pm_opp_attach_genpd() dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core") Signed-off-by: Tang Bin [ Viresh: Replace ENODATA with ENODEV ] Signed-off-by: Viresh Kumar --- diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 84063ea..ff03647 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2528,8 +2528,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, } virt_dev = dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR(virt_dev)) { - ret = PTR_ERR(virt_dev); + if (IS_ERR_OR_NULL(virt_dev)) { + ret = PTR_ERR(virt_dev) ? : -ENODEV; dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); goto err; }