From patchwork Fri Sep 8 19:46:08 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: 9944955 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 04681604D5 for ; Fri, 8 Sep 2017 19:47:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECB2C203B9 for ; Fri, 8 Sep 2017 19:47:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E183827BFF; Fri, 8 Sep 2017 19:47:19 +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 064B8285F1 for ; Fri, 8 Sep 2017 19:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756839AbdIHTqV (ORCPT ); Fri, 8 Sep 2017 15:46:21 -0400 Received: from mout.web.de ([212.227.17.11]:56798 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756688AbdIHTqT (ORCPT ); Fri, 8 Sep 2017 15:46:19 -0400 Received: from [192.168.1.2] ([92.228.166.205]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MhDYL-1e3nFa3mi1-00MNop; Fri, 08 Sep 2017 21:46:12 +0200 Subject: [PATCH 3/3] [media] fsl-viu: Adjust six checks for null pointers From: SF Markus Elfring To: linux-media@vger.kernel.org, Arvind Yadav , Bhumika Goyal , Geliang Tang , Hans Verkuil , Mauro Carvalho Chehab , Prabhakar Lad Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: Date: Fri, 8 Sep 2017 21:46:08 +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:R5H8g+f2ptInXzRGfYuBV7v+gDSYuFSZ444NKjHy0vqOGw8kFBQ Sb8CQK7lcWCP0YWMRwS8hEr5EdGz25iNmM+LOy8uYlezg8XJxlEWDv5HIQPkaT/2U+93nPp SnZt/NBZIyj2xs//oi+dCSkkmLC44gslXUvXAMMJ6fXusdwc/X87lAMqJ8tReADZTr+uEXX L40V+2l8L06NVP0+yf/ag== X-UI-Out-Filterresults: notjunk:1; V01:K0:nkLtKJVxTsU=:21AeAEmMxLCWBTZwDFiP+Q /+et41m4pVH5ii0rha8qjmdeY6wnLv8V5+e2z9a+0TpX4OOOIbcB7YuNKo1Wk8YLlVR5ur+sT 7D3V6hH9viQZQRfQI+XB1aLdeKT9BAxPO+1V0WupCbvrO6RJ0NsguBhM+ki+Dpjr5IreLcyjO 3f4pBHaMlVrlKIrW/DG6U+WnAzQYt5hkmoLHc00x91S30X6ivdMlyc1L7iw3qf+4eqQBnkBVO bBupQhnU6phq+yJGBKejZBz6NqS6cDjUycMU3FdFlhFhJnR7L038NqjbsudKw3L6B9pBAXbXJ MpxGhv8Zd9iRcygFhpqLuGZspScVw/TrjmOBKEVKUqWkPe8i6+djKU26JIoxhUF1a0SHHoTha EM8q4DH4SEbRAiNYrlJVDcTssgJJaN2PcOgY5TGMKJhvH2Z2fuALcsviR8N+0qGWBlfE0a3KO 5fwoPZxh4z3p+ELR1dpzQNTDB4mLWzNvhRISK8bP5EkxSnL4md+Y+3odZvsKvWThsyAGesPKu sM+MpU38LH1R/x8cAy7emMqg8UZunVGNuZf3Eu15nItzPZoAMIltkObkzN2Y+GgfX5L54oNPU P/gs4pCUTYMUmY6QPn6et1ihU0f1UFfEu0NcsdtYD9SIrcXsSfIyTEfZ8hSt2hgpu5Z/7m7Ku 7m8iSOequUwpmqDh88OHZhG4qMWP5rZM8R/TMp4KaCfE4VOYzWmB5ZPvh8MQY86a3wIaFWaZE F6fscoFH3KlIzuld86zoCfYwq0wokHSW3h5L4Ni1N1qFbp946jFXIdcpfMz+e0XOuZ6oLBdo1 K8+6eTT+2RNpn5nmXm7epRMwKli4YJqrRgRBfjcP2LvGU9VwWE= 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 21:16:50 +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/fsl-viu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c index 1fe2a295db93..a133dfdd869a 100644 --- a/drivers/media/platform/fsl-viu.c +++ b/drivers/media/platform/fsl-viu.c @@ -313,7 +313,7 @@ static int restart_video_queue(struct viu_dmaqueue *vidq) if (list_empty(&vidq->queued)) return 0; buf = list_entry(vidq->queued.next, struct viu_buf, vb.queue); - if (prev == NULL) { + if (!prev) { list_move_tail(&buf->vb.queue, &vidq->active); dprintk(1, "Restarting video dma\n"); @@ -450,7 +450,7 @@ static int buffer_prepare(struct videobuf_queue *vq, struct viu_buf *buf = container_of(vb, struct viu_buf, vb); int rc; - BUG_ON(fh->fmt == NULL); + BUG_ON(!fh->fmt); if (fh->width < 48 || fh->width > norm_maxw() || fh->height < 32 || fh->height > norm_maxh()) @@ -668,9 +668,9 @@ static int verify_preview(struct viu_dev *dev, struct v4l2_window *win) enum v4l2_field field; int maxw, maxh; - if (dev->ovbuf.base == NULL) + if (!dev->ovbuf.base) return -EINVAL; - if (dev->ovfmt == NULL) + if (!dev->ovfmt) return -EINVAL; if (win->w.width < 48 || win->w.height < 32) return -EINVAL; @@ -825,7 +825,7 @@ int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer * /* check args */ fmt = format_by_fourcc(fb->fmt.pixelformat); - if (fmt == NULL) + if (!fmt) return -EINVAL; /* ok, accept it */ @@ -1472,7 +1472,7 @@ static int viu_of_probe(struct platform_device *op) /* Allocate memory for video device */ vdev = video_device_alloc(); - if (vdev == NULL) { + if (!vdev) { ret = -ENOMEM; goto err_vdev; }