From patchwork Thu Sep 14 10:32:36 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: 9952695 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 A903A60317 for ; Thu, 14 Sep 2017 10:32:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89CFE28E61 for ; Thu, 14 Sep 2017 10:32:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EAF328E87; Thu, 14 Sep 2017 10:32:49 +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 2E64228E61 for ; Thu, 14 Sep 2017 10:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751686AbdINKcr (ORCPT ); Thu, 14 Sep 2017 06:32:47 -0400 Received: from mout.web.de ([212.227.17.11]:61356 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbdINKcq (ORCPT ); Thu, 14 Sep 2017 06:32:46 -0400 Received: from [192.168.1.2] ([85.182.44.111]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LwqJw-1dLWKz22CO-016MKJ; Thu, 14 Sep 2017 12:32:37 +0200 Subject: [PATCH 2/8] [media] ttusb_dec: Adjust five checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Hans Verkuil , Laurent Pinchart , Mauro Carvalho Chehab , Sakari Ailus Cc: LKML , kernel-janitors@vger.kernel.org References: <66b087d3-6dd3-1e1c-d33d-e34c9e2ffe25@users.sourceforge.net> Message-ID: <4cd3254b-abc3-2145-e693-c454a13d1a2a@users.sourceforge.net> Date: Thu, 14 Sep 2017 12:32:36 +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: <66b087d3-6dd3-1e1c-d33d-e34c9e2ffe25@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:0+KtLAChPoz7f5qU4qiwXbPk7XyQ73/rUIMfjbWKgXEvjaL0JAu +h0uUAoETEkTqXqcosOEFlpZSnGkPmpc+zSN7V956XnSndU5GuJxAholNQf1CSd30KqW85G Isr2ymaMXZP6xjxk5c050bxR3r2yUEQ+ka9BBuUdvRFGKY3mbWbqCEj1Olpvhc6tshzp+H2 69aGbbXmMLE2k9Cl1m6EQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:oRnn5ksuA7w=:ETeW9jiHP/IibQyMewlE8F lE8c4UojkGfZ2RW6LHSUDDwxDvUSeibzOBZu+M+TStkS3ktbELG4O349rs4v9IWQ9g6lxLaDh lXZ7DSZTxdfjTmlNEyyHA8kF/e2tbzV0oO3NAD2WgDbKsVSvoPqFTL1OrgEyC+YVy9CJ+452Z RFvhqTkWLnoWN1GCvUVR6swib+JjZKh0ienSSCVTZvOZQp0IuxD62YyH7A+7THPQmGw4UQtKv qZh14jVBR0j4dWaFI6pEbnIdaLVM/iCfl6Z9VrdHz7VoXMlHrGLh1UN5Z30BpASBKWnGVpF/3 Fbez03Zi0o9GUiwYtVHxy10vv/Uel/9bNU9QvP2o6ZrtI83EPqcNIw9pnId5nAE4HHAtb2qH+ cQ6a18RuBh0AO1Lm0zEecaot59IWsa5u0rHHzQlWQTLgsAuCvCRW9ZGzH6DVyfYUSMcJ19GqC Sj7yEmf800PITq99SWAeEfM/aADUXYNMSL9NGuooU9pdwHOpHfkEb3gJSLK1lTwyesA7t+pzF R8KFi+iln1dLwhSI1aYZBO8B/rz1jgChQv+JNaMQdG+28/Qs90dW3E6hZfQo1ZZwZPhsLOMM0 B45Tn/f4xf5bwgIr3e9T9n5FJkuNkHHqcSbpbdkCW7gcOEcyaTIAPNcGGUiBzxZFrGrfbWvII q9cvMK6VhKvRk8kBzUr42Jfja/Xh6LnP/wYYwsY+B8qQcKZ948o1UohISQKfh2cbFY5lrPcHX qudyKz5nhf/MMQ715Pth6V+a1/a/Ldkw7ogoT4j5YuTXOMgVGnkJFGyU9zssSDiY05Po4a2v+ ELfYMbKAvkfgebaUVLxcKHvI8Po+YF0w8nho20xwfQWQFKOP/s= 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: Wed, 13 Sep 2017 18:22:35 +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/ttusb-dec/ttusb_dec.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index 0bc80daf6e2e..901cb221aad2 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -406,15 +406,15 @@ static int ttusb_dec_get_stb_state (struct ttusb_dec *dec, unsigned int *mode, return result; if (c_length >= 0x0c) { - if (mode != NULL) { + if (mode) { memcpy(&tmp, c, 4); *mode = ntohl(tmp); } - if (model != NULL) { + if (model) { memcpy(&tmp, &c[4], 4); *model = ntohl(tmp); } - if (version != NULL) { + if (version) { memcpy(&tmp, &c[8], 4); *version = ntohl(tmp); } @@ -1393,7 +1393,7 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) j = 0; b = kmalloc(ARM_PACKET_SIZE, GFP_KERNEL); - if (b == NULL) { + if (!b) { release_firmware(fw_entry); return -ENOMEM; } @@ -1703,18 +1703,17 @@ static int ttusb_dec_probe(struct usb_interface *intf, break; } - if (dec->fe == NULL) { + if (!dec->fe) printk("dvb-ttusb-dec: A frontend driver was not found for device [%04x:%04x]\n", le16_to_cpu(dec->udev->descriptor.idVendor), le16_to_cpu(dec->udev->descriptor.idProduct)); - } else { + else if (dvb_register_frontend(&dec->adapter, dec->fe)) { printk("budget-ci: Frontend registration failed!\n"); if (dec->fe->ops.release) dec->fe->ops.release(dec->fe); dec->fe = NULL; } - } ttusb_dec_init_v_pes(dec); ttusb_dec_init_filters(dec);