lkml.org 
[lkml]   [2022]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cocinelle: iterators: optimize device_node_continue rule
Date
Execute the device_node_continue.cocci for kernel source. Get an error
report as following:
./drivers/pci/hotplug/pnv_php.c:161:2-13: ERROR: probable double put.

After analysis, we can find that it is false positive, because it is to
detach the node from device tree. And we can abstract out an exception.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
scripts/coccinelle/iterators/device_node_continue.cocci | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/coccinelle/iterators/device_node_continue.cocci b/scripts/coccinelle/iterators/device_node_continue.cocci
index f8cd14dfa604..4b8ee3316a8c 100644
--- a/scripts/coccinelle/iterators/device_node_continue.cocci
+++ b/scripts/coccinelle/iterators/device_node_continue.cocci
@@ -49,9 +49,11 @@ for_each_node_with_property(n,e1) S
&
i@p1(...) {
... when != of_node_get(n)
+ when != of_detach_node(n)
when any
of_node_put@p2(n);
- ... when any
+ ... when != of_detach_node(n)
+ when any
}
)

--
2.25.1
\
 
 \ /
  Last update: 2022-04-19 13:52    [W:0.022 / U:3.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site