summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@inria.fr>2026-08-27 13:29:49 +0200
committerJiri Kosina <jkosina@suse.com>2026-09-11 16:52:18 +0200
commit31fe2cb51133f00e1138c617fef8ee808a37714d (patch)
tree6b8b0c9446b8cb530a78419ec35d542e5a8207cc /scripts
parentd3aba3442798ce4a4c8ce3104d7b286d61e605f9 (diff)
downloadlinux-31fe2cb51133f00e1138c617fef8ee808a37714d.tar.gz
linux-31fe2cb51133f00e1138c617fef8ee808a37714d.zip
HID: fix semantic patch and improve its performance
Replace "expression" with "identifier" in the declaration of hdev. This is necessary because hdev is used as the name of a function parameter. Move the two uses of @p2 to the relevant function names. Convert <... ...>, meaning that the contained pattern is optional, to use ..., when any, and exists. This requires that the function contain calls to hid_hw_start, etc, which reduces the set of files that are considered for matching against this pattern. Reported-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Jiri Kosina <jkosina@suse.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/hid/ff_race.cocci11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/coccinelle/hid/ff_race.cocci b/scripts/coccinelle/hid/ff_race.cocci
index 479f5d1e3184..e861de00cb10 100644
--- a/scripts/coccinelle/hid/ff_race.cocci
+++ b/scripts/coccinelle/hid/ff_race.cocci
@@ -7,18 +7,19 @@
virtual report
-@r@
+@r exists@
identifier probe_fn;
-expression hdev, flags;
+identifier hdev;
+expression flags;
position p1, p2;
@@
probe_fn(struct hid_device *hdev, ...) {
- <...
+ ... when any
hid_hw_start@p1(hdev, flags)
...
- \(input_ff_create\|input_ff_create_memless\)@p2(...)
- ...>
+ \(input_ff_create@p2\|input_ff_create_memless@p2\)(...)
+ ... when any
}
@script:python depends on report@