summaryrefslogtreecommitdiffstats
path: root/drivers/opp/core.c
diff options
context:
space:
mode:
authorTang Bin <tangbin@cmss.chinamobile.com>2022-05-24 20:31:51 +0800
committerViresh Kumar <viresh.kumar@linaro.org>2022-06-06 11:58:51 +0530
commit4ea9496cbc959eb5c78f3e379199aca9ef4e386b (patch)
tree0216f4fe0f321d26a9da8109d983f575cb15fc2d /drivers/opp/core.c
parentf2906aa863381afb0015a9eb7fefad885d4e5a56 (diff)
downloadlinux-4ea9496cbc959eb5c78f3e379199aca9ef4e386b.tar.bz2
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 <tangbin@cmss.chinamobile.com> [ Viresh: Replace ENODATA with ENODEV ] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp/core.c')
-rw-r--r--drivers/opp/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 84063eaebb91..ff0364733dcb 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;
}