From patchwork Wed Oct 12 15:13:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9373411 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 BBA93607FD for ; Wed, 12 Oct 2016 15:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD2F32944A for ; Wed, 12 Oct 2016 15:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0FFD295A1; Wed, 12 Oct 2016 15:15: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 14D6D2944A for ; Wed, 12 Oct 2016 15:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755359AbcJLPOr (ORCPT ); Wed, 12 Oct 2016 11:14:47 -0400 Received: from mout.web.de ([212.227.15.4]:61997 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933838AbcJLPOB (ORCPT ); Wed, 12 Oct 2016 11:14:01 -0400 Received: from [192.168.1.2] ([78.49.9.22]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0MUnuu-1bMCm243My-00Y8P5; Wed, 12 Oct 2016 17:13:51 +0200 Subject: [PATCH 32/34] [media] DaVinci-VPIF-Display: Adjust 11 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: Date: Wed, 12 Oct 2016 17:13:50 +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:r3WwEHPoQv+TT8HbogdG3Pb/I5anFO40oCJG2TlZG407/kfStnT ftirooYUgBPpbjzjU4880PCfDdW/m8JvCkTsJABuTRYxDn2wOGTOz6F8juWyJdmarLuEDsh Jbk+9YDeOfWS/FQjLBeriGLKLUU3u9/h+DQ2DW5ohYXCFlCAliyEq8K1sVjRRyNh3Ti9IFS j9kX+lJ1oqKVEedPGRMqw== X-UI-Out-Filterresults: notjunk:1; V01:K0:gYg7QPz9cH8=:igApQ0JN2NBD/35TY9rRZS 7HDBo92l/3nm4sKmKbwUMB7KDsNl31y5xYl++4CYhuoCCaoRiEgkAcV44vgvJe+CanyH0GNxC HSf/+eqXyKthTmGqm+pJxsS1HlBncxfKGgQ7E0xDliYqXX5nx0zb6bCBIHnle0yKaigavylTG fFnLKvojhldGaYMRTXagsrG8601zzLOQqLbZyPdWUeMDvSch9chPtt2qtfTmRDuKi37lTUpul jOPoWBGfHLh6C5dK4rPdACOWtAfPfuXjB9OKg6QZwAFOc9nUw9FpDfalMVLD58LNEoR8Rfs2t fAe7zBrPpIjfGRfLijjl+ZkEFT/e569U2XzGVzLcdUmw6mODrwOz/3LjQg1iUYENB6IkRBzDy vPvvdkS5ktTk4+PZSiWk5IP/rLjBwUnR3ny75C3CuPuUvFtS6jId4agEi9KekYcYXdxd8Ajb8 RDfT7JpoCLeO7ktoMwRnSOHpa1D4R9FDcISCc1Yda311zu/Wdj64AocFSjIHPu/8zJkzcy0/I GZ+btlO7m2FwNd4s0AjaQ50PT2Mieu02KNIRPnewnsGknfE0B9pZXgV7hBK42IY3+XLK24g0O b1jldRWcsydvudeWp94VUljyt+u7/F0gBdueV/k1vkITDZzFM0yuW9LGTUcGZmKiLa4OGCWKJ x/f09kaiuZU1la2ZtNPouAmHwlMVIYjvepTs34DwnS8ELFJYRSCVs5LIRcy+7vi0/J69qElEl MJCsYvj32xVl2YgL8ljb6/ZZR8vzh1s5eKO9No6VnP/d9gcDZnqcXSD97yOspdmlq6iA69MRY oAYhRGx 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 15:40:32 +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/platform/davinci/vpif_display.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_display.c b/drivers/media/platform/davinci/vpif_display.c index 3347fa14..fff1ece 100644 --- a/drivers/media/platform/davinci/vpif_display.c +++ b/drivers/media/platform/davinci/vpif_display.c @@ -271,10 +271,10 @@ static void vpif_stop_streaming(struct vb2_queue *vq) vb2_buffer_done(&common->cur_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); } else { - if (common->cur_frm != NULL) + if (common->cur_frm) vb2_buffer_done(&common->cur_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); - if (common->next_frm != NULL) + if (common->next_frm) vb2_buffer_done(&common->next_frm->vb.vb2_buf, VB2_BUF_STATE_ERROR); } @@ -686,7 +686,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id std_id) struct v4l2_output output; int ret; - if (config->chan_config[ch->channel_id].outputs == NULL) + if (!config->chan_config[ch->channel_id].outputs) return -ENODATA; chan_cfg = &config->chan_config[ch->channel_id]; @@ -732,7 +732,7 @@ static int vpif_g_std(struct file *file, void *priv, v4l2_std_id *std) struct vpif_display_chan_config *chan_cfg; struct v4l2_output output; - if (config->chan_config[ch->channel_id].outputs == NULL) + if (!config->chan_config[ch->channel_id].outputs) return -ENODATA; chan_cfg = &config->chan_config[ch->channel_id]; @@ -783,11 +783,11 @@ vpif_output_to_subdev(struct vpif_display_config *vpif_cfg, vpif_dbg(2, debug, "vpif_output_to_subdev\n"); - if (chan_cfg->outputs == NULL) + if (!chan_cfg->outputs) return -1; subdev_name = chan_cfg->outputs[index].subdev_name; - if (subdev_name == NULL) + if (!subdev_name) return -1; /* loop through the sub device list to get the sub device info */ @@ -833,7 +833,7 @@ static int vpif_set_output(struct vpif_display_config *vpif_cfg, } ch->output_idx = index; ch->sd = sd; - if (chan_cfg->outputs != NULL) + if (chan_cfg->outputs) /* update tvnorms from the sub device output info */ ch->video_dev.tvnorms = chan_cfg->outputs[index].output.std; return 0; @@ -885,7 +885,7 @@ vpif_enum_dv_timings(struct file *file, void *priv, struct v4l2_output output; int ret; - if (config->chan_config[ch->channel_id].outputs == NULL) + if (!config->chan_config[ch->channel_id].outputs) return -ENODATA; chan_cfg = &config->chan_config[ch->channel_id]; @@ -922,7 +922,7 @@ static int vpif_s_dv_timings(struct file *file, void *priv, struct v4l2_output output; int ret; - if (config->chan_config[ch->channel_id].outputs == NULL) + if (!config->chan_config[ch->channel_id].outputs) return -ENODATA; chan_cfg = &config->chan_config[ch->channel_id]; @@ -1021,7 +1021,7 @@ static int vpif_g_dv_timings(struct file *file, void *priv, struct video_obj *vid_ch = &ch->video; struct v4l2_output output; - if (config->chan_config[ch->channel_id].outputs == NULL) + if (!config->chan_config[ch->channel_id].outputs) goto error; chan_cfg = &config->chan_config[ch->channel_id]; @@ -1280,7 +1280,7 @@ static __init int vpif_probe(struct platform_device *pdev) subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; vpif_obj.sd = kcalloc(subdev_count, sizeof(*vpif_obj.sd), GFP_KERNEL); - if (vpif_obj.sd == NULL) { + if (!vpif_obj.sd) { err = -ENOMEM; goto vpif_unregister; }