From patchwork Mon Dec 28 14:09:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 2377 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 28 Dec 2009 14:13:11 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Mon, 28 Dec 2009 12:17:36 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NPGLO-0000Zs-Rc; Mon, 28 Dec 2009 14:13:11 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbZL1OMR (ORCPT + 1 other); Mon, 28 Dec 2009 09:12:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751141AbZL1OMR (ORCPT ); Mon, 28 Dec 2009 09:12:17 -0500 Received: from mgw1.diku.dk ([130.225.96.91]:35345 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbZL1OMQ (ORCPT ); Mon, 28 Dec 2009 09:12:16 -0500 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id DFCD252C41B; Mon, 28 Dec 2009 15:12:14 +0100 (CET) X-Virus-Scanned: amavisd-new at diku.dk Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sDFyog2izrgR; Mon, 28 Dec 2009 15:12:12 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id E7C8452C43C; Mon, 28 Dec 2009 15:09:55 +0100 (CET) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id B0DA16DFEEC; Mon, 28 Dec 2009 15:05:44 +0100 (CET) Received: by ask.diku.dk (Postfix, from userid 3767) id CA8224AE2; Mon, 28 Dec 2009 15:09:55 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id C17974632; Mon, 28 Dec 2009 15:09:55 +0100 (CET) Date: Mon, 28 Dec 2009 15:09:55 +0100 (CET) From: Julia Lawall To: mchehab@infradead.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drivers/media/video: Correct NULL test Message-ID: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Julia Lawall Test the just-allocated value for NULL rather than some other value. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r@ identifier f; @@ f(...) { <+... return NULL; ...+> } @@ expression *x; expression y; identifier r.f; statement S; @@ x = f(...); ( if ((x) == NULL) S | if ( - y + x == NULL) S ) // Signed-off-by: Julia Lawall --- drivers/media/video/usbvision/usbvision-video.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 -u -p a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c @@ -1487,7 +1487,7 @@ static int __devinit usbvision_register_ usbvision->vbi = usbvision_vdev_init(usbvision, &usbvision_vbi_template, "USBVision VBI"); - if (usbvision->vdev == NULL) { + if (usbvision->vbi == NULL) { goto err_exit; } if (video_register_device(usbvision->vbi,