Skip to contentSkip to conversation

PM / OPP: fix odd_ptr_err.cocci warnings

PATCH In review Julia Lawall 2 participants 2 messages Dec 2, 2016 – Dec 5, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / OPP: fix odd_ptr_err.cocci warnings

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

---

I haven't checked the context, but the code looks suspicious.

This is derived from the following tree:

tree:   https://git.linaro.org/people/vireshk/linux opp/redesign
head:   fbf8f0c337a7cfcd4cb67865b5ea710e69c21f1f
commit: 5fe43a6b46470d22938bc443cf0ea20ed01a93b6 [32/33] PM / OPP: Take

kref from _find_opp_table()
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago

 core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/opp/core.c +1 -1
@@ -644,7 +644,7 @@ int dev_pm_opp_set_rate(struct device *d
 	if (IS_ERR(clk)) {
 		dev_err(dev, "%s: No clock available for the device\n",
 			__func__);
-		ret = PTR_ERR(opp_table);
+		ret = PTR_ERR(clk);
 		goto put_opp_table;
 	}
 
#1 lore raw
Quoted 25 lines · Julia Lawall

PTR_ERR should access the value just tested by IS_ERR

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

---

I haven't checked the context, but the code looks suspicious.

This is derived from the following tree:

tree:   https://git.linaro.org/people/vireshk/linux opp/redesign
head:   fbf8f0c337a7cfcd4cb67865b5ea710e69c21f1f
commit: 5fe43a6b46470d22938bc443cf0ea20ed01a93b6 [32/33] PM / OPP: Take

kref from _find_opp_table()
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago

 core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

drivers/base/power/opp/core.c int dev_pm_opp_set_rate(struct device *d · line 649

Quoted 7 lines
drivers/base/power/opp/core.c +1 -1
@@ -644,7 +644,7 @@ int dev_pm_opp_set_rate(struct device *d
 	if (IS_ERR(clk)) {
 		dev_err(dev, "%s: No clock available for the device\n",
 			__func__);
-		ret = PTR_ERR(opp_table);
+		ret = PTR_ERR(clk);
 		goto put_opp_table;
 	}

Fixed, thanks.

Signature · 1 line
viresh