]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
opp: Fix error check in dev_pm_opp_attach_genpd()
authorTang Bin <tangbin@cmss.chinamobile.com>
Tue, 24 May 2022 12:31:51 +0000 (20:31 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 17 Oct 2022 09:56:47 +0000 (11:56 +0200)
BugLink: https://bugs.launchpad.net/bugs/1990162
[ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/opp/core.c

index 04b4691a8aac7ff65e94a19f21637304dd3e14ab..b2da497dd378b59f80804de0057f4da50082d8c2 100644 (file)
@@ -2388,8 +2388,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;
                }