summaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle
diff options
context:
space:
mode:
authorVaishali Thakkar <vaishali.thakkar@oracle.com>2016-11-23 14:16:39 +0530
committerMichal Marek <mmarek@suse.com>2016-12-11 12:08:26 +0100
commitdca24c4544d96989f521b5aa49fd44ae0ae5a5b6 (patch)
treeded14a63d661f7f2ac911f271d16b0ff3bea8e70 /scripts/coccinelle
parent51a5f81079bfbd146b7162580c2170289c7cb413 (diff)
downloadlinux-stable-dca24c4544d96989f521b5aa49fd44ae0ae5a5b6.tar.gz
linux-stable-dca24c4544d96989f521b5aa49fd44ae0ae5a5b6.tar.bz2
linux-stable-dca24c4544d96989f521b5aa49fd44ae0ae5a5b6.zip
Coccinelle: misc: Improve the matching of rules
Currently because of the left associativity of the operators, pattern IRQF_ONESHOT | flags does not match with the pattern when we have more than one flag after the disjunction. This eventually results in giving false positives by the script. This patch eliminates these FPs by improving the rule. Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com> Signed-off-by: Michal Marek <mmarek@suse.com>
Diffstat (limited to 'scripts/coccinelle')
-rw-r--r--scripts/coccinelle/misc/irqf_oneshot.cocci36
1 files changed, 23 insertions, 13 deletions
diff --git a/scripts/coccinelle/misc/irqf_oneshot.cocci b/scripts/coccinelle/misc/irqf_oneshot.cocci
index b421150a2eff..cbe4ba8f293a 100644
--- a/scripts/coccinelle/misc/irqf_oneshot.cocci
+++ b/scripts/coccinelle/misc/irqf_oneshot.cocci
@@ -15,16 +15,13 @@ virtual org
virtual report
@r1@
-expression dev;
-expression irq;
-expression thread_fn;
-expression flags;
+expression dev, irq, thread_fn;
position p;
@@
(
request_threaded_irq@p(irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
@@ -32,21 +29,34 @@ IRQF_ONESHOT
|
devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
(
-flags | IRQF_ONESHOT
+IRQF_ONESHOT | ...
|
IRQF_ONESHOT
)
, ...)
)
-@depends on patch@
-expression dev;
-expression irq;
-expression thread_fn;
-expression flags;
+@r2@
+expression dev, irq, thread_fn, flags, e;
position p != r1.p;
@@
(
+flags = IRQF_ONESHOT | ...
+|
+flags |= IRQF_ONESHOT | ...
+)
+... when != flags = e
+(
+request_threaded_irq@p(irq, NULL, thread_fn, flags, ...);
+|
+devm_request_threaded_irq@p(dev, irq, NULL, thread_fn, flags, ...);
+)
+
+@depends on patch@
+expression dev, irq, thread_fn, flags;
+position p != {r1.p,r2.p};
+@@
+(
request_threaded_irq@p(irq, NULL, thread_fn,
(
-0
@@ -69,13 +79,13 @@ devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
)
@depends on context@
-position p != r1.p;
+position p != {r1.p,r2.p};
@@
*request_threaded_irq@p(...)
@match depends on report || org@
expression irq;
-position p != r1.p;
+position p != {r1.p,r2.p};
@@
request_threaded_irq@p(irq, NULL, ...)