From patchwork Wed Oct 12 17:15:49 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: 9373611 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 6C5EC60487 for ; Wed, 12 Oct 2016 17:17:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5780C29395 for ; Wed, 12 Oct 2016 17:17:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46D232967B; Wed, 12 Oct 2016 17:17:45 +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 A421B29395 for ; Wed, 12 Oct 2016 17:17:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755781AbcJLRRI (ORCPT ); Wed, 12 Oct 2016 13:17:08 -0400 Received: from mout.web.de ([212.227.15.3]:63222 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754719AbcJLRRE (ORCPT ); Wed, 12 Oct 2016 13:17:04 -0400 Received: from [192.168.1.2] ([78.49.9.22]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0M8zhl-1biV2O3SBh-00CNrJ; Wed, 12 Oct 2016 19:15:57 +0200 Subject: [PATCH resent 03/34] [media] DaVinci-VPBE: Adjust 16 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 19:15:49 +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:W8kV0WQtVX5qvzAq8OrRXzQ4jVmqUPfIgDSgZk17kZbPTkoXYe9 tdTNHE7hmxeF0IML7kTTv1tDDbN5rakuRUIDbZWyNOzJXk/VRaXo6ZFQCdEXEPwH+GXDwd4 6WR2xQSlRllj4bfCqPp7vj1Jda1Aj46/4NbvsK7u/2C0qG6a6lrC6INCnaYPjdzdC6yCcPH I6YgqYkCmOZqO8HuZj9rA== X-UI-Out-Filterresults: notjunk:1; V01:K0:j79QPH+R3zU=:LwCCj++HPcJDU+XqyVShv1 mMyaUcNS5qBp2SzR9ll+1RAOS0z0VQGx1K7U3E15sIYtEFevwoxlT3fu8rWANjx4ev8F2qwVN +uxqX42t5DEf9A6J5fPhLGbahFwNjrQ4ykxqmKznfAGuU0Cg14VzK6BUHDibroFinJyTSn3Sb n4RF/r9sr/6gQSIZmmuXa8l+4rX46+EzapxDAXb6aFaD/R1LzDtC4F4R2olg2v69ARURB1A06 C8YxO2T9anUiqudp1yeNMo+QCblY+462COu2qr3ClzO/QWI8FrQinpMk4NVfyh4ZyuOTe2ooG W/Vvzzcz7wt8DKj9yZsPulB2Azn4owcCCx9XdC4eBQSHXMdupzzY1yimyyqGvKuet+3veScQ3 nzpmV30oMEUyGPK9pQRVIRW43vwAIyBFJrhFhCrrMhN3mpD8EjcrQOe2E6LUYKkaCRQFw2tlI 8FgmKIQuFznpJ1qyh4Y75a9VE72s5di4N7kBhF27EWtOw7Cxnx3a+Je6Nq3KBaCFsWm3Rb45C IZfOObM6lEiccFwBvrERoXuLoBsymSxEkKE6DnE7GyaeLrG+zLr+ZwpduHMingh3AjWWb38Bz JBwEYVXe013rPY4aJ0Ee+E3Zk7+o3oAbQqnYinNHdnG8M67coKfoxQz0wZeODXglyujBO/CeM B60ibBOhHf+n6UiKOnzETtozNFfcwQ0q7eB7g7L6+/oATeo098Jx5hJAN+1BoSVwyCFguIeH5 ujtdw8bY7xksfaZoxzNJfKMc0sjn4UAWw+FuGYEUcz7ha/AC7wiRvTB628ey41F8n87bmYnLW +VABtDO 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: Tue, 11 Oct 2016 13:37:10 +0200 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 --- Another send try because of the following notification: Mailer Daemon wrote on 2016-10-12 at 16:39: > This message was created automatically by mail delivery software. > > A message that you sent could not be delivered to one or more of > its recipients. This is a permanent error. The following address(es) > failed: > > linux-kernel@vger.kernel.org: > SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte > r texts. BF:; S1755378AbcJLOjE > > linux-media@vger.kernel.org: > SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte > r texts. BF:; S1755378AbcJLOjE > > kernel-janitors@vger.kernel.org: > SMTP error from remote server for TEXT command, host: vger.kernel.org (209.132.180.67) reason: 550 5.7.1 Content-Policy reject msg: Wrong MIME labeling on 8-bit characte > r texts. BF:; S1755378AbcJLOjE drivers/media/platform/davinci/vpbe.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c index b479747..496b27f 100644 --- a/drivers/media/platform/davinci/vpbe.c +++ b/drivers/media/platform/davinci/vpbe.c @@ -107,7 +107,7 @@ static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg, static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev, struct v4l2_cropcap *cropcap) { - if (NULL == cropcap) + if (!cropcap) return -EINVAL; cropcap->bounds.left = 0; cropcap->bounds.top = 0; @@ -149,7 +149,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode, int curr_output = output_index; int i; - if (NULL == mode) + if (!mode) return -EINVAL; for (i = 0; i < cfg->outputs[curr_output].num_modes; i++) { @@ -166,7 +166,7 @@ static int vpbe_get_mode_info(struct vpbe_device *vpbe_dev, char *mode, static int vpbe_get_current_mode_info(struct vpbe_device *vpbe_dev, struct vpbe_enc_mode_info *mode_info) { - if (NULL == mode_info) + if (!mode_info) return -EINVAL; *mode_info = vpbe_dev->current_timings; @@ -356,7 +356,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev, ret = v4l2_subdev_call(vpbe_dev->encoders[sd_index], video, s_dv_timings, dv_timings); - if (!ret && (vpbe_dev->amp != NULL)) { + if (!ret && vpbe_dev->amp) { /* Call amplifier subdevice */ ret = v4l2_subdev_call(vpbe_dev->amp, video, s_dv_timings, dv_timings); @@ -512,7 +512,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, int ret = 0; int i; - if ((NULL == mode_info) || (NULL == mode_info->name)) + if (!mode_info || !mode_info->name) return -EINVAL; for (i = 0; i < cfg->outputs[out_index].num_modes; i++) { @@ -536,7 +536,7 @@ static int vpbe_set_mode(struct vpbe_device *vpbe_dev, } /* Only custom timing should reach here */ - if (preset_mode == NULL) + if (!preset_mode) return -EINVAL; mutex_lock(&vpbe_dev->lock); @@ -570,9 +570,9 @@ static int platform_device_get(struct device *dev, void *data) struct platform_device *pdev = to_platform_device(dev); struct vpbe_device *vpbe_dev = data; - if (strstr(pdev->name, "vpbe-osd") != NULL) + if (strstr(pdev->name, "vpbe-osd")) vpbe_dev->osd_device = platform_get_drvdata(pdev); - if (strstr(pdev->name, "vpbe-venc") != NULL) + if (strstr(pdev->name, "vpbe-venc")) vpbe_dev->venc_device = dev_get_platdata(&pdev->dev); return 0; @@ -606,7 +606,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) * from the platform device by iteration of platform drivers and * matching with device name */ - if (NULL == vpbe_dev || NULL == dev) { + if (!vpbe_dev || !dev) { printk(KERN_ERR "Null device pointers.\n"); return -ENODEV; } @@ -652,7 +652,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) vpbe_dev->venc = venc_sub_dev_init(&vpbe_dev->v4l2_dev, vpbe_dev->cfg->venc.module_name); /* register venc sub device */ - if (vpbe_dev->venc == NULL) { + if (!vpbe_dev->venc) { v4l2_err(&vpbe_dev->v4l2_dev, "vpbe unable to init venc sub device\n"); ret = -ENODEV; @@ -660,8 +660,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) } /* initialize osd device */ osd_device = vpbe_dev->osd_device; - - if (NULL != osd_device->ops.initialize) { + if (osd_device->ops.initialize) { err = osd_device->ops.initialize(osd_device); if (err) { v4l2_err(&vpbe_dev->v4l2_dev, @@ -679,7 +678,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) vpbe_dev->encoders = kmalloc_array(num_encoders, sizeof(*vpbe_dev->encoders), GFP_KERNEL); - if (NULL == vpbe_dev->encoders) { + if (!vpbe_dev->encoders) { ret = -ENOMEM; goto fail_dev_unregister; } @@ -715,7 +714,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev) } /* Add amplifier subdevice for dm365 */ if ((strcmp(vpbe_dev->cfg->module_name, "dm365-vpbe-display") == 0) && - vpbe_dev->cfg->amp != NULL) { + vpbe_dev->cfg->amp) { amp_info = vpbe_dev->cfg->amp; if (amp_info->is_i2c) { vpbe_dev->amp = v4l2_i2c_new_subdev_board( @@ -824,7 +823,7 @@ static int vpbe_probe(struct platform_device *pdev) struct vpbe_config *cfg; int ret = -EINVAL; - if (pdev->dev.platform_data == NULL) { + if (!pdev->dev.platform_data) { v4l2_err(pdev->dev.driver, "No platform data\n"); return -ENODEV; }