From patchwork Sat May 14 14:18:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 785022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4EEJSLd020209 for ; Sat, 14 May 2011 14:19:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757499Ab1ENOTN (ORCPT ); Sat, 14 May 2011 10:19:13 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:41706 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755496Ab1ENOTB (ORCPT ); Sat, 14 May 2011 10:19:01 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 3DF5E19BBF9; Sat, 14 May 2011 16:19:00 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03321-19; Sat, 14 May 2011 16:18:55 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 67E3619BC07; Sat, 14 May 2011 16:18:55 +0200 (CEST) From: Julia Lawall To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, Jarod Wilson , Lucas De Marchi , =?UTF-8?q?David=20H=C3=A4rdeman?= , Joe Perches , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] drivers/media/rc/imon.c: Correct call to input_free_device Date: Sat, 14 May 2011 16:18:55 +0200 Message-Id: <1305382735-11474-2-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 14 May 2011 14:19:28 +0000 (UTC) From: Julia Lawall 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/) // @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) // Signed-off-by: Julia Lawall --- drivers/media/rc/imon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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;