From patchwork Wed Oct 12 14:58:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9373391 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 C417060487 for ; Wed, 12 Oct 2016 15:03:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B555728459 for ; Wed, 12 Oct 2016 15:03:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9E4329DA7; Wed, 12 Oct 2016 15:03:35 +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 4008C28459 for ; Wed, 12 Oct 2016 15:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755241AbcJLO7L (ORCPT ); Wed, 12 Oct 2016 10:59:11 -0400 Received: from mout.web.de ([212.227.15.14]:61772 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755147AbcJLO6t (ORCPT ); Wed, 12 Oct 2016 10:58:49 -0400 Received: from [192.168.1.2] ([78.49.9.22]) by smtp.web.de (mrweb003) with ESMTPSA (Nemesis) id 0Mcnuz-1bcwb02emH-00Hwoo; Wed, 12 Oct 2016 16:58:39 +0200 Subject: [PATCH 20/34] [media] DaVinci-VPFE-Capture: Adjust 13 checks for null pointers To: linux-media@vger.kernel.org, Hans Verkuil , "Lad, Prabhakar" , Mauro Carvalho Chehab References: Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <111cbf0f-7fe6-63e7-6577-0724f3789226@users.sourceforge.net> Date: Wed, 12 Oct 2016 16:58:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: X-Provags-ID: V03:K0:G79HXPD2JDj3Mwzw+1MudRh+fTiumT2ffqpkXeDLPBcR3MjAjFC CPENz17kxT2XqHz+6v8C7k5cTOiW6SebERTftmqhESQ5Y9xxpoDjRqS3Kggzg6EnxE4+sk5 hAcWvovlsYUFtxDh8gBxgga8OYsUrNsm4Q0jUWDJKazDpzEVWv/h94FMPRWdnKVC+opxinF 4X5ijzRYhr3Cs5ddbiXeQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:FPaXZTVmFzE=:5ok9pwPZyK4cZZZVp0bSeE FdzKTs7xxKizcgYjve7FoWAJRxPvpLD9KT9mdwfActv9rQynTlyxCKaBdWA1NYeAJJOHVan14 du0aOKflxvT+YlpDIzMb1KrSoU8Ny7lorZc+1NuLEk3Fx3XbXDCsDfbJSwR7YwTH6v7pw/QN0 Px7ep9zdw9kXi93sgTkUb6ienP2PdJJgfaFLuFAif5w15qt+3ccu++nWGyeq4WjVLKQwS48V5 bE/vW/o2yyZgIKwMFs//LtqmoiC4MO+RrMdWWi7QINjI9CU4u+LOHObENqz3Obdwrfpe5gmoX lJF9YeNM/ODjn6lF7DJlsqP2jHyNoMW529UUBNOmlviGmj0eUsUFHeE1bvQobKEefQWAL5wU+ d9clKsKMFW9VE8mMPOj0U8KhKxKhCaGRhAkqJsRhe8bU0eIcecaJlpoGrAteGAaVR/LmC4UMT 0FcXu5aUbcOZGWbcv7pK/ROOtB1PHLBiK8vabNDDVHcOtPrAnibX4izUdyOFpXC8vkGBnSljF KTPJBbQ9m9AlVIBvfLIieahvqMYOwycJfO0z46Cj+nKfe5zdeKUaIksT1JdYwNKbvymFherqH phLQboxoUY5jv715vG/theC1ZdHNh/bdxm6DJntywEXZsN9BbSHdlkFxKdBkNG0xsi8EhiV2X wUxJiVVeCHHGtacw688rnNgBXUcsPrNayVJgS+YaVMXbKnkC72Hg71qh6p/c32CROUhxZq3ht bY1f8s2db9rC/t5zocu4eMhK2ZNlyJPnIvd76wMVSz/XuxrQFs46pcQgte8FVF3RzIE+fxfUZ OBM8dBE 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, 12 Oct 2016 10:46:28 +0200 Convert comparisons with the preprocessor symbol "NULL" to condition checks without it. Signed-off-by: Markus Elfring --- drivers/media/platform/davinci/vpfe_capture.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index e370400..9da353b 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -229,7 +229,7 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev) BUG_ON(!dev->hw_ops.getfid); mutex_lock(&ccdc_lock); - if (NULL == ccdc_cfg) { + if (!ccdc_cfg) { /* * TODO. Will this ever happen? if so, we need to fix it. * Proabably we need to add the request to a linked list and @@ -265,7 +265,7 @@ EXPORT_SYMBOL(vpfe_register_ccdc_device); */ void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev) { - if (NULL == dev) { + if (!dev) { printk(KERN_ERR "invalid ccdc device ptr\n"); return; } @@ -469,7 +469,7 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev) /* now open the ccdc device to initialize it */ mutex_lock(&ccdc_lock); - if (NULL == ccdc_dev) { + if (!ccdc_dev) { v4l2_err(&vpfe_dev->v4l2_dev, "ccdc device not registered\n"); ret = -ENODEV; goto unlock; @@ -582,7 +582,7 @@ static irqreturn_t vpfe_isr(int irq, void *dev_id) goto clear_intr; /* only for 6446 this will be applicable */ - if (NULL != ccdc_dev->hw_ops.reset) + if (ccdc_dev->hw_ops.reset) ccdc_dev->hw_ops.reset(); if (field == V4L2_FIELD_NONE) { @@ -822,7 +822,7 @@ static const struct vpfe_pixel_format * int temp, found; vpfe_pix_fmt = vpfe_lookup_pix_format(pixfmt->pixelformat); - if (NULL == vpfe_pix_fmt) { + if (!vpfe_pix_fmt) { /* * use current pixel format in the vpfe device. We * will find this pix format in the table @@ -965,7 +965,7 @@ static int vpfe_enum_fmt_vid_cap(struct file *file, void *priv, /* Fill in the information about format */ pix_fmt = vpfe_lookup_pix_format(pix); - if (NULL != pix_fmt) { + if (pix_fmt) { temp_index = fmt->index; *fmt = pix_fmt->fmtdesc; fmt->index = temp_index; @@ -991,8 +991,7 @@ static int vpfe_s_fmt_vid_cap(struct file *file, void *priv, /* Check for valid frame format */ pix_fmts = vpfe_check_format(vpfe_dev, &fmt->fmt.pix); - - if (NULL == pix_fmts) + if (!pix_fmts) return -EINVAL; /* store the pixel format in the device object */ @@ -1018,7 +1017,7 @@ static int vpfe_try_fmt_vid_cap(struct file *file, void *priv, v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_try_fmt_vid_cap\n"); pix_fmts = vpfe_check_format(vpfe_dev, &f->fmt.pix); - if (NULL == pix_fmts) + if (!pix_fmts) return -EINVAL; return 0; } @@ -1833,7 +1832,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_dev->pdev = &pdev->dev; - if (NULL == pdev->dev.platform_data) { + if (!pdev->dev.platform_data) { v4l2_err(pdev->dev.driver, "Unable to get vpfe config\n"); ret = -ENODEV; goto probe_free_dev_mem; @@ -1841,9 +1840,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_cfg = pdev->dev.platform_data; vpfe_dev->cfg = vpfe_cfg; - if (NULL == vpfe_cfg->ccdc || - NULL == vpfe_cfg->card_name || - NULL == vpfe_cfg->sub_devs) { + if (!vpfe_cfg->ccdc || !vpfe_cfg->card_name || !vpfe_cfg->sub_devs) { v4l2_err(pdev->dev.driver, "null ptr in vpfe_cfg\n"); ret = -ENOENT; goto probe_free_dev_mem; @@ -1938,7 +1935,7 @@ static int vpfe_probe(struct platform_device *pdev) vpfe_dev->sd = kmalloc_array(num_subdevs, sizeof(*vpfe_dev->sd), GFP_KERNEL); - if (NULL == vpfe_dev->sd) { + if (!vpfe_dev->sd) { ret = -ENOMEM; goto probe_out_video_unregister; }