All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cocinelle: iterators: optimize device_node_continue rule
@ 2022-04-19 12:10 ` Ziyang Xuan
  0 siblings, 0 replies; 2+ messages in thread
From: Ziyang Xuan @ 2022-04-19 12:10 UTC (permalink / raw)
  To: Julia.Lawall, nicolas.palix, daniel.thompson, cocci, linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [cocci] [PATCH] cocinelle: iterators: optimize device_node_continue rule
@ 2022-04-19 12:10 ` Ziyang Xuan
  0 siblings, 0 replies; 2+ messages in thread
From: Ziyang Xuan @ 2022-04-19 12:10 UTC (permalink / raw)
  To: Julia.Lawall, nicolas.palix, daniel.thompson, cocci, linux-kernel

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-19 15:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 12:10 [PATCH] cocinelle: iterators: optimize device_node_continue rule Ziyang Xuan
2022-04-19 12:10 ` [cocci] " Ziyang Xuan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.