From patchwork Mon Jul 4 14:11:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 127 Return-path: Envelope-to: mchehab@pedra Delivery-date: Mon, 04 Jul 2011 11:15:07 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1QdjvX-0000bN-4X for mchehab@pedra; Mon, 04 Jul 2011 11:15:07 -0300 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Mon, 04 Jul 2011 11:15:07 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QdjuI-0008TZ-Az; Mon, 04 Jul 2011 14:13:50 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755594Ab1GDOMe (ORCPT + 1 other); Mon, 4 Jul 2011 10:12:34 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:35340 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753287Ab1GDOLv (ORCPT ); Mon, 4 Jul 2011 10:11:51 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id 0C6CE19BB9E; Mon, 4 Jul 2011 16:11:50 +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 00533-07; Mon, 4 Jul 2011 16:11:45 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 5954619BB97; Mon, 4 Jul 2011 16:11:45 +0200 (CEST) From: Julia Lawall To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, Devin Heitmueller , Sri Devi , Jarod Wilson , Laurent Pinchart , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] drivers/media/video/cx231xx/cx231xx-cards.c: add missing kfree Date: Mon, 4 Jul 2011 16:11:41 +0200 Message-Id: <1309788705-22278-1-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: From: Julia Lawall Clear the cx231xx_devused variable and free dev in the error handling code, as done in the error handling code nearby. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier x; @@ kfree(x) @@ identifier r.x; expression E1!=0,E2,E3,E4; statement S; @@ ( if (<+...x...+>) S | if (...) { ... when != kfree(x) when != if (...) { ... kfree(x); ... } when != x = E3 * return E1; } ... when != x = E2 if (...) { ... when != x = E4 kfree(x); ... return ...; } ) // Signed-off-by: Julia Lawall --- drivers/media/video/cx231xx/cx231xx-cards.c | 3 +++ 1 file changed, 3 insertions(+) -- 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/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 2270381..c46dca9 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -1051,6 +1051,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, if (assoc_desc->bFirstInterface != ifnum) { cx231xx_err(DRIVER_NAME ": Not found " "matching IAD interface\n"); + cx231xx_devused &= ~(1 << nr); + kfree(dev); + dev = NULL; return -ENODEV; }