Skip to contentSkip to conversation

PM / devfreq: fix odd_ptr_err.cocci warnings (fwd)

PATCH New Julia Lawall 1 participant 1 message Mar 1, 2021 Device frequency (devfreq)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / devfreq: fix odd_ptr_err.cocci warnings (fwd)

Hello,

There seems to be an inconsistency, but the patch proposed by Coccinelle does not look correct. There should be a test on opp_table.

julia

---------- Forwarded message ----------
Date: Mon, 1 Mar 2021 16:35:52 +0800
From: kernel test robot <[email protected]>
To: kbuild(a)lists.01.org
Cc: lkp(a)intel.com, Julia Lawall <[email protected]>
Subject: [PATCH] PM / devfreq: fix odd_ptr_err.cocci warnings

CC: kbuild-all(a)lists.01.org
TO: Saravana Kannan <[email protected]>
CC: Chanwoo Choi <[email protected]>
CC: Sibi Sankar <[email protected]>
CC: MyungJoo Ham <[email protected]>
CC: Kyungmin Park <[email protected]>
CC: linux-pm(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

From: kernel test robot <[email protected]>

drivers/devfreq/governor_passive.c:318:7-13: inconsistent IS_ERR and PTR_ERR on line 319.

PTR_ERR should access the value just tested by IS_ERR

Semantic patch information:
There can be false positives in the patch case, where it is the call to IS_ERR that is wrong.

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

Fixes 82d4ff586ae2 ("PM / devfreq: Add cpu based scaling support to passive governor")
CC Saravana Kannan <[email protected]>

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git devfreq-testing-passive-gov
head:   82d4ff586ae2fb6d89cad871949004bed3438ccb
commit: 82d4ff586ae2fb6d89cad871949004bed3438ccb [3/3] PM / devfreq: Add cpu based scaling support to passive governor

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

Please take the patch only if it's a positive warning. Thanks!

 governor_passive.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/devfreq/governor_passive.c +1 -1
@@ -316,7 +316,7 @@ static int cpufreq_passive_register(stru
 
 			opp_table = dev_pm_opp_get_opp_table(cpu_dev);
 			if (IS_ERR(devfreq->opp_table)) {
-				ret = PTR_ERR(opp_table);
+				ret = PTR_ERR(devfreq->opp_table);
 				goto out;
 			}