From patchwork Fri Sep 8 12:33:30 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: 9943855 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 BB0156034B for ; Fri, 8 Sep 2017 12:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEA67286CB for ; Fri, 8 Sep 2017 12:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A37D4286CF; Fri, 8 Sep 2017 12:33:55 +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 4ED39286CB for ; Fri, 8 Sep 2017 12:33:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755732AbdIHMdi (ORCPT ); Fri, 8 Sep 2017 08:33:38 -0400 Received: from mout.web.de ([217.72.192.78]:58169 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754986AbdIHMdh (ORCPT ); Fri, 8 Sep 2017 08:33:37 -0400 Received: from [192.168.1.2] ([92.228.166.205]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MWjAd-1dwjTc3QLL-00XtQT; Fri, 08 Sep 2017 14:33:32 +0200 Subject: [PATCH 3/3] [media] DaVinci-VPBE-Display: Adjust 12 checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Prabhakar Lad Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <3331c4f8-a327-abc6-df00-09e67d3769fe@users.sourceforge.net> Date: Fri, 8 Sep 2017 14:33:30 +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:6hKG7sNyUf6kKp4TixfTASFC4s0SQnhikRaUZVg4l7wJSiQoM2S 6IRdafFzvUu9x/rlRexg4l2JdU+8Gwo9FlLM9BfTNYnWUKWbCU1XOwjz3gQ3/yY29j/iO5T H9p+sO5ifTsBTb74lgkefNoSHkVMfEtRPH2QOg/Y2EC45PWD5Xem+i2BQlxhxCpPYN6PkJL ZA/dPm2PkJRk4j2NZqXmA== X-UI-Out-Filterresults: notjunk:1; V01:K0:IHPNx9ZC+S4=:RGELVItcxuFQxRMzMEDFNv Q3KVZI7LF5WRPnNcfYYdiBfMTkyK1x52x3gZ6TBudlt4jbjQoA2GWF+TZi4p9kqu22KK9Rn79 D5kyYg4H7ESRLXYXIYQ2SwmO1Ch7T2TPqnUI1T9eUm2z9Ox2o0eiIifA+lL2NbP4CTRkx1EIz LDB2Lda19Opi0yKI3CnQai3D9PkxQIniBvuLUsAngpGrV+h+1FRO6TH9PIo0dA7geeyyRkKUS CuAnj90SqnaEfnSHXzXowUbKi2BhkUk1UeE5PtyPe9PdrwZDk6rgP0fPiO/GIwvlcLPnz8W2r LqAX1zj26a3AwOUcLoWmii58SrzaubiY0OVC6x8E1ZC0w/apIN0fh2X6BEJn2Mkb95yGt5zmj Xr70RSBjCBAx1ERFvZ5ZXIUXs1Gh2vc5UVvCkpmVh66S1Z0piBHviJpyjTi2i50jYnaNvWvtJ CyY9WDM+AcxhkmsxsJNXM0ANcbrfgPvlyl6ksa3Vx1Z4tBj8YQXku/QbSyht4lJK9bxn3rqm8 rRNiV+XywPMCVD+Plx5NYvdaS3F9Jei1hrOjbUW2QU8qV8C3Ch+7MNUSpK7n8psbzzu9i4oGu 5PY+KeDdXL46TAJx4FBsydqixwcHrjm2zcFAWOL+MRp00kjkr4gH0sipc668H571Puut7bBQi L9DbQ9z3bHdzeacPe7eIvKtBB/2OY2IO8g9NeILzh0YlvA6Dw0FFMWpwh8TfLr0Ejy6Q4V2D7 blhMZQX5lDUNwQvG3P6SW5rVa3Ub78jRf3+6WBE8TGwgXgJ5aV120T85AYRVKyNN4MmHxVbOP XJ9vxGYXKDxXXPTY++Kdu75fiAXH/EmgX8NpLXNOcSeHsqd4tc= 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: Fri, 8 Sep 2017 14:00:20 +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 Acked-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpbe_display.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c index afe31900f5de..6aabd21fe69f 100644 --- a/drivers/media/platform/davinci/vpbe_display.c +++ b/drivers/media/platform/davinci/vpbe_display.c @@ -122,7 +122,7 @@ static irqreturn_t venc_isr(int irq, void *arg) int fid; int i; - if ((NULL == arg) || (NULL == disp_dev->dev[0])) + if (!arg || !disp_dev->dev[0]) return IRQ_HANDLED; if (venc_is_second_field(disp_dev)) @@ -337,10 +337,10 @@ static void vpbe_stop_streaming(struct vb2_queue *vq) vb2_buffer_done(&layer->cur_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); } else { - if (layer->cur_frm != NULL) + if (layer->cur_frm) vb2_buffer_done(&layer->cur_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); - if (layer->next_frm != NULL) + if (layer->next_frm) vb2_buffer_done(&layer->next_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); } @@ -947,7 +947,7 @@ static int vpbe_display_s_std(struct file *file, void *priv, if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - if (NULL != vpbe_dev->ops.s_std) { + if (vpbe_dev->ops.s_std) { ret = vpbe_dev->ops.s_std(vpbe_dev, std_id); if (ret) { v4l2_err(&vpbe_dev->v4l2_dev, @@ -1000,8 +1000,7 @@ static int vpbe_display_enum_output(struct file *file, void *priv, v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_OUTPUT\n"); /* Enumerate outputs */ - - if (NULL == vpbe_dev->ops.enum_outputs) + if (!vpbe_dev->ops.enum_outputs) return -EINVAL; ret = vpbe_dev->ops.enum_outputs(vpbe_dev, output); @@ -1030,7 +1029,7 @@ static int vpbe_display_s_output(struct file *file, void *priv, if (vb2_is_busy(&layer->buffer_queue)) return -EBUSY; - if (NULL == vpbe_dev->ops.set_output) + if (!vpbe_dev->ops.set_output) return -EINVAL; ret = vpbe_dev->ops.set_output(vpbe_dev, i); @@ -1077,7 +1076,7 @@ vpbe_display_enum_dv_timings(struct file *file, void *priv, v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_ENUM_DV_TIMINGS\n"); /* Enumerate outputs */ - if (NULL == vpbe_dev->ops.enum_dv_timings) + if (!vpbe_dev->ops.enum_dv_timings) return -EINVAL; ret = vpbe_dev->ops.enum_dv_timings(vpbe_dev, timings); @@ -1292,7 +1291,7 @@ static int vpbe_device_get(struct device *dev, void *data) if (strcmp("vpbe_controller", pdev->name) == 0) vpbe_disp->vpbe_dev = platform_get_drvdata(pdev); - if (strstr(pdev->name, "vpbe-osd") != NULL) + if (strstr(pdev->name, "vpbe-osd")) vpbe_disp->osd_device = platform_get_drvdata(pdev); return 0; @@ -1408,7 +1407,7 @@ static int vpbe_display_probe(struct platform_device *pdev) v4l2_dev = &disp_dev->vpbe_dev->v4l2_dev; /* Initialize the vpbe display controller */ - if (NULL != disp_dev->vpbe_dev->ops.initialize) { + if (disp_dev->vpbe_dev->ops.initialize) { err = disp_dev->vpbe_dev->ops.initialize(&pdev->dev, disp_dev->vpbe_dev); if (err) { @@ -1476,7 +1475,7 @@ static int vpbe_display_probe(struct platform_device *pdev) probe_out: for (k = 0; k < VPBE_DISPLAY_MAX_DEVICES; k++) { /* Unregister video device */ - if (disp_dev->dev[k] != NULL) { + if (disp_dev->dev[k]) { video_unregister_device(&disp_dev->dev[k]->video_dev); kfree(disp_dev->dev[k]); } @@ -1498,7 +1497,7 @@ static int vpbe_display_remove(struct platform_device *pdev) v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "vpbe_display_remove\n"); /* deinitialize the vpbe display controller */ - if (NULL != vpbe_dev->ops.deinitialize) + if (vpbe_dev->ops.deinitialize) vpbe_dev->ops.deinitialize(&pdev->dev, vpbe_dev); /* un-register device */ for (i = 0; i < VPBE_DISPLAY_MAX_DEVICES; i++) {