[PATCH 0/7] ensure arguments to request_irq and free_irq are compatible

From: Julia Lawall
Date: Sun Mar 11 2012 - 15:37:11 EST


As far as I can see, free_irq does nothing if its second argument is not
the same as the last argument of the corresponding call to request_irq.
These were found using the semantic match below (http://coccinelle.lip6.fr/).
This semantic match finds a number of other cases, but they are mostly in
platform driver probe functions, so the functions should be just converted
to use devm functions, eliminating the need to call free_irq at all.

// <smpl>
@r exists@
expression e,e1,e2,e3,e4,e5;
type T;
position p1,p2;
@@

request_irq@p1(e1,e2,e3,e4,e5)
...
(
free_irq(e1,(T)e5);
|
free_irq@p2(e1,e);
)

@bad1 exists@
position r.p1,r.p2;
expression e1,e2,e3,e4,e5;
@@

request_irq@p1(e1,e2,e3,e4,(void *)e5)
...
free_irq@p2(e1,e5);

@bad2 exists@
position r.p1,r.p2;
statement S;
@@

if (request_irq@p1(...)) S else { <+... free_irq@p2(...); ...+> }

@script:python depends on !bad1 && !bad2@
p1 << r.p1;
p2 << r.p2;
@@

cocci.print_main("",p1)
cocci.print_secs("",p2)
// </smpl>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/