From patchwork Sat Aug 26 20:50:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9923611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 57DC1603FA for ; Sat, 26 Aug 2017 20:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29874285D9 for ; Sat, 26 Aug 2017 20:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C058285E4; Sat, 26 Aug 2017 20:51:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE9A9285D9 for ; Sat, 26 Aug 2017 20:51:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751101AbdHZUvB (ORCPT ); Sat, 26 Aug 2017 16:51:01 -0400 Received: from mout.web.de ([212.227.17.11]:50577 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbdHZUvA (ORCPT ); Sat, 26 Aug 2017 16:51:00 -0400 Received: from [192.168.1.2] ([85.182.38.188]) by smtp.web.de (mrweb102 [213.165.67.124]) with ESMTPSA (Nemesis) id 0M2MYq-1dV06N267A-00sA51; Sat, 26 Aug 2017 22:50:47 +0200 Subject: [PATCH 2/3] [media] usbvision: Adjust eight checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Davidlohr Bueso , Hans Verkuil , Johan Hovold , Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <0a1d8712-5b0d-d453-88a1-b39556c9d09d@users.sourceforge.net> Date: Sat, 26 Aug 2017 22:50:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:CSWwVwyT4/wpWsNpaOlICgQicv1RhrG4MqDsgEo7s1eSy9TJ3j5 HfoqxXtHTLrbo94R+FulUMJxZxHekwnXg6CMoEJXs6R0j9EZF6VSu5HZqhhqqcyc9O2eZIE IH6i3/zcTHd7qlxLHfd3L6l0NovKBAAGMM/8zoVQPqq0JtGQds1Ug490JmruFjsYviRZCDd g1p0uheWPRHhJ+DfSir/w== X-UI-Out-Filterresults: notjunk:1; V01:K0:JYXURt0j86s=:AQYOyxAswBuco36azAAtyo yGv366/rJ/Ez8SZsk6aCvA6brgWDeR4ymObWPNWIg/9DNEBLiONcU0OyEza6cb4ClXSrr6VXG dUKXqahCJH1xlcHUHyYGPLeCy8/D0qlNCnpbP8ScR3mnW+NFQIuIKeQkJTLZlFNeEOgfLhclX vrMJCehyLJkJUJVaDkjcnSIaHsONPfFObqoIBvfct7b8y17VbSbpB8/r+JTfMs2suDepEzhiK jQTq2aLQYrWOLWlL+kXpq/i1ytrkf3L+9aBlV66ggwwODXdtx1HqwfRJYfwpGihsBLjoUi7Kz 4wX99dCoKLZw0n+51AKvK0VeIukCvtHUSHuw3vfhEQEOFzqypmdEXr6gMlfbOFDrdpF2piDP8 PwgGUOMo8wgEHtKvDaIIjoWc1QP0o4udBL3CnHDDIRNP73ikntMLfCLOYOqcppJClY/w187Vy bX3rQ7gYA1boYl9UxQDo4hZgWQu+ScRjzu1PquVBOenwSsU1IZ+Ssrt0aSpqvajwBaou5lJQL 7Ra3UpSDBq5F/JA3bbaRW3tXf7XPSzP3Y/WqElKjjfecmXnFm2gYYL8UaIO4kD16CgLQ1cF9L lZAZiv8ZltR6FshDbsIlZMYOom5ohX5gHZAYtOwkQnnQpuoh4XHyrQBt7yJxy7pWCesHhj6xG 7LF1Jb7w3U6q/ah3+wQ7hwtB5yCT32pXU3t/DnvNr5aVb3PsXKkhNbjami2Bl9NbCtzlteyTY 2eN19/3mFift4gfumb4Kr2eX7b7U1yF7jB5bP2AWOJVQadHwzAXwIsaYfFkqyLFDBV7Me5QZ7 Q6PUsZHPKOJnlNn2yvtECDIZeKII2sFA71/zmZsQ+Yt8Upih9A= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 26 Aug 2017 22:16:52 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written !… Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/media/usb/usbvision/usbvision-video.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index b74fb2dcb6f5..e6807bad9792 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c @@ -904,7 +904,7 @@ static ssize_t usbvision_read(struct file *file, char __user *buf, PDEBUG(DBG_IO, "%s: %ld bytes, noblock=%d", __func__, (unsigned long)count, noblock); - if (!USBVISION_IS_OPERATIONAL(usbvision) || (buf == NULL)) + if (!USBVISION_IS_OPERATIONAL(usbvision) || !buf) return -EFAULT; /* This entry point is compatible with the mmap routines @@ -1234,7 +1234,7 @@ static void usbvision_vdev_init(struct usb_usbvision *usbvision, { struct usb_device *usb_dev = usbvision->dev; - if (usb_dev == NULL) { + if (!usb_dev) { dev_err(&usbvision->dev->dev, "%s: usbvision->dev is not set\n", __func__); return; @@ -1323,4 +1323,4 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev, - if (usbvision == NULL) + if (!usbvision) return NULL; usbvision->dev = dev; @@ -1334,7 +1334,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev, /* prepare control urb for control messages during interrupts */ usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); - if (usbvision->ctrl_urb == NULL) + if (!usbvision->ctrl_urb) goto err_unreg; return usbvision; @@ -1380,7 +1380,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) { int model; - if (usbvision == NULL) + if (!usbvision) return; model = usbvision->dev_model; @@ -1474,7 +1474,7 @@ static int usbvision_probe(struct usb_interface *intf, } usbvision = usbvision_alloc(dev, intf); - if (usbvision == NULL) { + if (!usbvision) { dev_err(&intf->dev, "%s: couldn't allocate USBVision struct\n", __func__); ret = -ENOMEM; goto err_usb; @@ -1494,5 +1494,5 @@ static int usbvision_probe(struct usb_interface *intf, usbvision->num_alt = uif->num_altsetting; PDEBUG(DBG_PROBE, "Alternate settings: %i", usbvision->num_alt); usbvision->alt_max_pkt_size = kmalloc(32 * usbvision->num_alt, GFP_KERNEL); - if (usbvision->alt_max_pkt_size == NULL) { + if (!usbvision->alt_max_pkt_size) { ret = -ENOMEM; @@ -1565,7 +1565,7 @@ static void usbvision_disconnect(struct usb_interface *intf) PDEBUG(DBG_PROBE, ""); - if (usbvision == NULL) { + if (!usbvision) { pr_err("%s: usb_get_intfdata() failed\n", __func__); return; }