From patchwork Sat Sep 2 18:43:06 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: 9935691 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 6090F601A1 for ; Sat, 2 Sep 2017 18:43:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 558A4285D8 for ; Sat, 2 Sep 2017 18:43:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A21728681; Sat, 2 Sep 2017 18:43:34 +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 F107A285D8 for ; Sat, 2 Sep 2017 18:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752752AbdIBSnU (ORCPT ); Sat, 2 Sep 2017 14:43:20 -0400 Received: from mout.web.de ([212.227.17.11]:62318 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752694AbdIBSnT (ORCPT ); Sat, 2 Sep 2017 14:43:19 -0400 Received: from [192.168.1.2] ([78.48.84.48]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MGRVU-1djlOM3i2S-00DCtO; Sat, 02 Sep 2017 20:43:07 +0200 Subject: [PATCH 3/3] [media] cx18: Adjust ten checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Andy Walls , Mauro Carvalho Chehab Cc: LKML , kernel-janitors@vger.kernel.org References: <016d4c9c-1d8e-e277-5d7c-f433553cf0fa@users.sourceforge.net> Message-ID: <57bf3409-b4b2-9771-ff81-13768d460d4d@users.sourceforge.net> Date: Sat, 2 Sep 2017 20:43:06 +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: <016d4c9c-1d8e-e277-5d7c-f433553cf0fa@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:/brwrMS5yLp97a9Yw+8y20KOsT7Q+uyph30zISEVg8zGyd5s782 OY4lwYu1QembeWXthWICKZFftRccwo9f0zmuCjigQBYxm8TBVh4bjIpEeuF163s+rq9E9lv 84FSVNQ5d3x56OgDnuEBopAUVXucIbG0lMc+9q/338QZ9sRlyz0S5a8BOMIV7SzosSaradu 5i52pY9iSovd0nNKizG9A== X-UI-Out-Filterresults: notjunk:1; V01:K0:K2DWnIcQa8k=:70UyYD7RnXinD8ubv5xRxc RdbLVyFVT8gtDZ89WIzWgRcF6y9jfEk4t36xqgx+y1dMjqqbPcWwKl+PO9461d+z4s48YF2qK oNZfcmegfOoMFA/z0m9gQ3pPADhzSqulf7kGH9Pq3sH1lLRDbfyGvZ6gs/sCvTvmMMCAELC2H ipnNgTRe2HLzvLHTAdhd7p8bd2qRnKZTV3U7bFs+BcvaqXU5aC5XO2ckjP5A5oj1nixhfLHHg CxMDVeV2fqwyVwZhAmo8taPC0u5RenRyHF3WnRXfVWsoY8siZKj4jh6JhPaxGEFL6rp2X7WXh X2AMPfy4d9ekN0xzeKiLVrPCIXFO30V17EQAdD8FKvh/mTr6l2ig+PJt8e4N9akFEOZ2omiXf N5wA9/128Y3AUIcft5FKREMrLRJQR+G5H72XEmsqa5BQy6TqCRvHC1vWO9UPqE7gv7+KRpThu iHmOxXQjP6z3v6RhweLTiPbesOF873TjPEkAsKUwYpLmwpuWwgfHkOJCI8flmMKkr6zZ+/B7G AOxfR7DExHXyq/lAQ/5GhwhiHMMD8//8J8P0mBuu0mykC0KBRb5aqlXr9EQcj8EUjZDAy3Gfo gwX7aceEFxDlxVFCy3lULcXp/sX9tEm21dg05wL8ZBQs/Iy3oe+332iDA2ofMWwVqVw5kqlpW faJsc6bocCoxY58fNHvZXuPfhwcMG4fsUWqIKkMY74Ub0EHOo+pZ2RohBs+7REVY/4rzV+1l2 237rtxKIE5uF1SKJmaQtzJD1k7BYSXTESYmiqntvy8PZ7FGBzrDuZ3mGzU6OtVb+TvQ1UKUGw alFiCu+KmVoYxFnK6oqm/JrP+zon7F8U/wsbyGCutgcTsXPb/0= 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, 2 Sep 2017 19:49:23 +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/pci/cx18/cx18-driver.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 49fc9b72ada5..c29e8ec880b3 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -255,7 +255,7 @@ static void request_module_async(struct work_struct *work) request_module("cx18-alsa"); /* Initialize cx18-alsa for this instance of the cx18 device */ - if (cx18_ext_init != NULL) + if (cx18_ext_init) cx18_ext_init(dev); } @@ -291,11 +291,11 @@ int cx18_msleep_timeout(unsigned int msecs, int intr) /* Release ioremapped memory */ static void cx18_iounmap(struct cx18 *cx) { - if (cx == NULL) + if (!cx) return; /* Release io memory */ - if (cx->enc_mem != NULL) { + if (cx->enc_mem) { CX18_DEBUG_INFO("releasing enc_mem\n"); iounmap(cx->enc_mem); cx->enc_mem = NULL; @@ -649,15 +649,15 @@ static void cx18_process_options(struct cx18 *cx) CX18_INFO("User specified %s card\n", cx->card->name); else if (cx->options.cardtype != 0) CX18_ERR("Unknown user specified type, trying to autodetect card\n"); - if (cx->card == NULL) { + if (!cx->card) { if (cx->pci_dev->subsystem_vendor == CX18_PCI_ID_HAUPPAUGE) { cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); CX18_INFO("Autodetected Hauppauge card\n"); } } - if (cx->card == NULL) { + if (!cx->card) { for (i = 0; (cx->card = cx18_get_card(i)); i++) { - if (cx->card->pci_list == NULL) + if (!cx->card->pci_list) continue; for (j = 0; cx->card->pci_list[j].device; j++) { if (cx->pci_dev->device != @@ -676,7 +676,7 @@ static void cx18_process_options(struct cx18 *cx) } done: - if (cx->card == NULL) { + if (!cx->card) { cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); CX18_ERR("Unknown card: vendor/device: [%04x:%04x]\n", cx->pci_dev->vendor, cx->pci_dev->device); @@ -698,7 +698,7 @@ static int cx18_create_in_workq(struct cx18 *cx) snprintf(cx->in_workq_name, sizeof(cx->in_workq_name), "%s-in", cx->v4l2_dev.name); cx->in_work_queue = alloc_ordered_workqueue("%s", 0, cx->in_workq_name); - if (cx->in_work_queue == NULL) { + if (!cx->in_work_queue) { CX18_ERR("Unable to create incoming mailbox handler thread\n"); return -ENOMEM; } @@ -1254,7 +1254,7 @@ static void cx18_cancel_out_work_orders(struct cx18 *cx) { int i; for (i = 0; i < CX18_MAX_STREAMS; i++) - if (&cx->streams[i].video_dev != NULL) + if (&cx->streams[i].video_dev) cancel_work_sync(&cx->streams[i].out_work_order); } @@ -1299,7 +1299,7 @@ static void cx18_remove(struct pci_dev *pci_dev) pci_disable_device(cx->pci_dev); - if (cx->vbi.sliced_mpeg_data[0] != NULL) + if (cx->vbi.sliced_mpeg_data[0]) for (i = 0; i < CX18_VBI_FRAMES; i++) kfree(cx->vbi.sliced_mpeg_data[i]);