Skip to content

Commit 2c2b913

Browse files
vrothbergmichal42
authored andcommitted
irqf_oneshot.cocci: add check of devm_request_threaded_irq()
Since commit 1c6c695 ("genirq: Reject bogus threaded irq requests") threaded IRQs without a primary handler need to be requested with IRQF_ONESHOT, otherwise the request will fail. Until now, this coccinelle script only checked request_threaded_irq(). However, the counterpart devm function (see kernel/irq/devres.c) is also affected by the missing flag which can be detected with this patch. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent c517d83 commit 2c2b913

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

scripts/coccinelle/misc/irqf_oneshot.cocci

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,38 @@ virtual org
1212
virtual report
1313

1414
@r1@
15+
expression dev;
1516
expression irq;
1617
expression thread_fn;
1718
expression flags;
1819
position p;
1920
@@
21+
(
2022
request_threaded_irq@p(irq, NULL, thread_fn,
2123
(
2224
flags | IRQF_ONESHOT
2325
|
2426
IRQF_ONESHOT
2527
)
2628
, ...)
29+
|
30+
devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
31+
(
32+
flags | IRQF_ONESHOT
33+
|
34+
IRQF_ONESHOT
35+
)
36+
, ...)
37+
)
2738

2839
@depends on patch@
40+
expression dev;
2941
expression irq;
3042
expression thread_fn;
3143
expression flags;
3244
position p != r1.p;
3345
@@
46+
(
3447
request_threaded_irq@p(irq, NULL, thread_fn,
3548
(
3649
-0
@@ -40,6 +53,17 @@ request_threaded_irq@p(irq, NULL, thread_fn,
4053
+flags | IRQF_ONESHOT
4154
)
4255
, ...)
56+
|
57+
devm_request_threaded_irq@p(dev, irq, NULL, thread_fn,
58+
(
59+
-0
60+
+IRQF_ONESHOT
61+
|
62+
-flags
63+
+flags | IRQF_ONESHOT
64+
)
65+
, ...)
66+
)
4367

4468
@depends on context@
4569
position p != r1.p;

0 commit comments

Comments
 (0)