* [PATCH 2/2] drivers/media/rc/imon.c: Correct call to input_free_device
@ 2011-05-14 14:18 Julia Lawall
0 siblings, 0 replies; only message in thread
From: Julia Lawall @ 2011-05-14 14:18 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: kernel-janitors, Jarod Wilson, Lucas De Marchi,
David Härdeman, Joe Perches, linux-media, linux-kernel
From: Julia Lawall <julia@diku.dk>
ictx->touch is intialied in imon_init_intf1, to the result of calling the
function that contains this code. Thus, in this code, input_free_device
should be called on touch itself.
A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)
// <smpl>
@r exists@
local idexpression struct input_dev * x;
expression ra,rr;
position p1,p2;
@@
x = input_allocate_device@p1(...)
... when != x = rr
when != input_free_device(x,...)
when != if (...) { ... input_free_device(x,...) ...}
if(...) { ... when != x = ra
when forall
when != input_free_device(x,...)
\(return <+...x...+>; \| return@p2...; \) }
@script:python@
p1 << r.p1;
p2 << r.p2;
@@
cocci.print_main("input_allocate_device",p1)
cocci.print_secs("input_free_device",p2)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/media/rc/imon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 8fc0f08..c400318 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1982,7 +1982,7 @@ static struct input_dev *imon_init_touch(struct imon_context *ictx)
return touch;
touch_register_failed:
- input_free_device(ictx->touch);
+ input_free_device(touch);
touch_alloc_failed:
return NULL;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-05-14 14:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-14 14:18 [PATCH 2/2] drivers/media/rc/imon.c: Correct call to input_free_device Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®