Skip to content

Commit d920920

Browse files
Mani-Sadhasivamvireshk
authored andcommitted
OPP: Fix passing 0 to PTR_ERR in _opp_attach_genpd()
If dev_pm_domain_attach_by_name() returns NULL, then 0 will be passed to PTR_ERR() as reported by the smatch warning below: drivers/opp/core.c:2456 _opp_attach_genpd() warn: passing zero to 'PTR_ERR' Fix it by checking for the non-NULL virt_dev pointer before passing it to PTR_ERR. Otherwise return -ENODEV. Fixes: 4ea9496 ("opp: Fix error check in dev_pm_opp_attach_genpd()") Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent 7ddd8de commit d920920

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/opp/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2460,7 +2460,7 @@ static int _opp_attach_genpd(struct opp_table *opp_table, struct device *dev,
24602460

24612461
virt_dev = dev_pm_domain_attach_by_name(dev, *name);
24622462
if (IS_ERR_OR_NULL(virt_dev)) {
2463-
ret = PTR_ERR(virt_dev) ? : -ENODEV;
2463+
ret = virt_dev ? PTR_ERR(virt_dev) : -ENODEV;
24642464
dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret);
24652465
goto err;
24662466
}

0 commit comments

Comments
 (0)