From patchwork Wed Sep 20 19:13:35 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: 9962165 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 DFC4660234 for ; Wed, 20 Sep 2017 19:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D34362911C for ; Wed, 20 Sep 2017 19:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C80A52912F; Wed, 20 Sep 2017 19:14:22 +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=unavailable 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 77A452911C for ; Wed, 20 Sep 2017 19:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbdITTN4 (ORCPT ); Wed, 20 Sep 2017 15:13:56 -0400 Received: from mout.web.de ([212.227.15.4]:56640 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbdITTNy (ORCPT ); Wed, 20 Sep 2017 15:13:54 -0400 Received: from [192.168.1.2] ([77.181.108.184]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MbQbk-1deJU40ldM-00Ikaa; Wed, 20 Sep 2017 21:13:36 +0200 Subject: [PATCH 3/3] [media] dvb-ttusb-budget: Adjust eight checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , "Gustavo A. R. Silva" , Hans Verkuil , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: <1ad3c3ce-3738-fee1-2ee5-37142fa1bc70@users.sourceforge.net> Message-ID: Date: Wed, 20 Sep 2017 21:13:35 +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: <1ad3c3ce-3738-fee1-2ee5-37142fa1bc70@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:33Pq8BxWPdaykDQeD3wlSHam7bU+n1pEZ1WI8GvGJXJNa3lhRCm 6ckzFX1ZAa54gMa56xLdfRoXqt68Rzn/yFMasWfKIomwPS05QHv9oBPPDHfbXLP1vbuoQZm /W+MgAva293UFWh5ihrsZqKKIO37te90/0IgcbLXERXnFXfAHwt4n3vb+N8GRaQaGBT2tuC u4k8ZE6Td+9z7TDASkVjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:t2cA31z0BuM=:ZnWel2JvwRLg61gj8Jm9Kg 6hmfSxE1dnTpZCZkqVSDvolyksrZ4EEYigvE6WJlWw5B7gwdpIgGqNwNywjC1gS7ZwgiBNurq IXteUYajuiBsG33Uwj3jlTRRJa+tXhxhdiCvUpYcor3CB9xMSW3XpXNAKYu4icBwukX18rm94 ubLPn6EgNNoPU136OUlgviqYJastLSle0ENovE2pN3amVcH8jZ8yH9ohky4IeAoTriSGQhorj Uth9tbMkCX6oj60Ms0VK0LcR+xb3iwdlRUKcWG+1GBYYZSXCdzB4bMT+GsY0DnuI3XHERqOCF 3rZevnrWlg6sjMjRlwwGQiIqwGcX39iywQXvt9GhZcpMVFeUlLn3AHpc1RGW0AKwGKT5ICGSx DK7SEqGiVfepEGAJKb524qsS6yCxS86UilRNp2wlUmWrIM7Ty/yaqyoIRcc+A5STCnR6kFfRB YrPa9o3gq7MEEPvxvp0vQS2+PpDy8ywgMEt1HZt66WEdq5oNdaOEo1N5Ssto1SZ8EoTlv92jb HdP6V8UN02DSOzvw7uR+RgTkvsi84TcYdzUy4K8CVXLNA/HePqyB3EsgnZsoMJzWLpqB4tmjC 9agbHMyX0Lr1HnsssGZtO0xjPPNcMhKgpTI/GX3Jp0d5SbXqiepQaNnpnyU4uRpDZs3MxaMbg DHwHQWU6fDGqtQuk8SGFV9mipMXGbDjY1iiS1hnOxGynmMfwR2zdYxpSOLqC+YWiBlPexnMqN RHHZXdMXjEgE+Akz6iaVOrZt/IZeRfKodobL/HgfD3w5RrhJgzE8SkK5bcm/N9h+OT2TjR5KJ k5Gq/uzc0FYa+y+2OQiF5Yv1CpDpOwEi7zPcmc05cEeGeumjgk= 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, 20 Sep 2017 20:53:13 +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-budget/dvb-ttusb-budget.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index fef3c8554e91..2e97b1e64249 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -1572,7 +1572,7 @@ static void frontend_init(struct ttusb* ttusb) case 0x1003: // Hauppauge/TT Nova-USB-S budget (stv0299/ALPS BSRU6|BSBE1(tsa5059)) // try the stv0299 based first ttusb->fe = dvb_attach(stv0299_attach, &alps_stv0299_config, &ttusb->i2c_adap); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.set_params = philips_tsa5059_tuner_set_params; if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1 @@ -1586,7 +1586,7 @@ static void frontend_init(struct ttusb* ttusb) // Grundig 29504-491 ttusb->fe = dvb_attach(tda8083_attach, &ttusb_novas_grundig_29504_491_config, &ttusb->i2c_adap); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.set_params = ttusb_novas_grundig_29504_491_tuner_set_params; ttusb->fe->ops.set_voltage = ttusb_set_voltage; break; @@ -1595,13 +1595,13 @@ static void frontend_init(struct ttusb* ttusb) case 0x1004: // Hauppauge/TT DVB-C budget (ves1820/ALPS TDBE2(sp5659)) ttusb->fe = dvb_attach(ves1820_attach, &alps_tdbe2_config, &ttusb->i2c_adap, read_pwm(ttusb)); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.set_params = alps_tdbe2_tuner_set_params; break; } ttusb->fe = dvb_attach(stv0297_attach, &dvbc_philips_tdm1316l_config, &ttusb->i2c_adap); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.set_params = dvbc_philips_tdm1316l_tuner_set_params; break; } @@ -1610,14 +1610,14 @@ static void frontend_init(struct ttusb* ttusb) case 0x1005: // Hauppauge/TT Nova-USB-t budget (tda10046/Philips td1316(tda6651tt) OR cx22700/ALPS TDMB7(??)) // try the ALPS TDMB7 first ttusb->fe = dvb_attach(cx22700_attach, &alps_tdmb7_config, &ttusb->i2c_adap); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.set_params = alps_tdmb7_tuner_set_params; break; } // Philips td1316 ttusb->fe = dvb_attach(tda10046_attach, &philips_tdm1316l_config, &ttusb->i2c_adap); - if (ttusb->fe != NULL) { + if (ttusb->fe) { ttusb->fe->ops.tuner_ops.init = philips_tdm1316l_tuner_init; ttusb->fe->ops.tuner_ops.set_params = philips_tdm1316l_tuner_set_params; break; @@ -1625,7 +1625,7 @@ static void frontend_init(struct ttusb* ttusb) break; } - if (ttusb->fe == NULL) { + if (!ttusb->fe) { printk("dvb-ttusb-budget: A frontend driver was not found for device [%04x:%04x]\n", le16_to_cpu(ttusb->dev->descriptor.idVendor), le16_to_cpu(ttusb->dev->descriptor.idProduct)); @@ -1781,7 +1781,7 @@ static void ttusb_disconnect(struct usb_interface *intf) dvb_net_release(&ttusb->dvbnet); dvb_dmxdev_release(&ttusb->dmxdev); dvb_dmx_release(&ttusb->dvb_demux); - if (ttusb->fe != NULL) { + if (ttusb->fe) { dvb_unregister_frontend(ttusb->fe); dvb_frontend_detach(ttusb->fe); }