From patchwork Sun Nov 26 10:22:07 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: 10075263 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 5B790602BD for ; Sun, 26 Nov 2017 10:23:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FE1A28E28 for ; Sun, 26 Nov 2017 10:23:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4448D28E3D; Sun, 26 Nov 2017 10:23:34 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAAE528E28 for ; Sun, 26 Nov 2017 10:23:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6729889D6C; Sun, 26 Nov 2017 10:23:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.web.de (mout.web.de [212.227.15.4]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04A2689D6C for ; Sun, 26 Nov 2017 10:23:29 +0000 (UTC) Received: from [192.168.1.3] ([78.49.168.181]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M5wkL-1f3Ig93HFB-00xty2; Sun, 26 Nov 2017 11:23:09 +0100 Subject: [PATCH 4/4] video: sm501fb: Adjust 15 checks for null pointers From: SF Markus Elfring To: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Alexey Khoroshilov , Bartlomiej Zolnierkiewicz , Bhumika Goyal , Colin Ian King , "Gustavo A. R. Silva" , Sudip Mukherjee References: Message-ID: Date: Sun, 26 Nov 2017 11:22:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-GB X-Provags-ID: V03:K0:RM6j/erpQwKTeO4VkHLiMtkUrXJkS7fHvzSbd5V8DdX3TG0dlVd knBm/oH3oQ9/jJxiy9vS6lp3mx8YPFR96of4SMnMh7Uv4ehC3V+KGeePFsbH1a5tfZ/6RI+ BoqJCHdDqvdmaZE+Qhi7zGGyiG1tVKBzzXz7AeuFfOlptuj1QMPDTWdWlkMnjkgiHI3+iFx KngfbwOyaDyngOIc3d8VQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:iTNoY7gFD44=:s9BFdHug4M62h3Z/7od/C1 jnmMe/dhZ3Gy2H7+c3kkiXtlycp7FCiROUq+v+9qT0HuHw2T9W4nXu7glF2ab+hJOf94FsNsO /oNYpmWslvPN6WL6RIAK7Bl17L+9d5/JmQhDzQMDAYM5VDBELWG/+vYWyVkZ9bAVQChFSC8Lz nEPJQsF8jrpSwjWZHKba+QUEDUx3pnKMuAdBDee+GYoyp9VzHaRiVP4iZcBpJtwg/4a1JGyQl +UCeq46+Ov51yrYRdqA4eUEsn8swfu9ut2sFffd1EO2CuYDObl52yQbIuDLG/keQt0+egTgXG KdHh54oLc9NqCC/gXmqKoq5MdA+dQK3qJ7jKufgS/0ykrVhanaxzagqN/sujUvRaz2/QUOGo6 c2/WMg9PYQRH/HUCINyKN7dyfGjck258kpcBf0HNpI8SEH5u4DfzrrYoI72R08NP2NI+2CWJL UYUYr/fj1CQp2Sdny1MINIFP0gJFWTqWVJNN1BvjIVvNkR+nPTgVgKYsa5CmPUYZbyasuwN6+ lFd7twdm1sZJQmpN0vuWB7y9MmS4ci0v5wEcsokhX14a04zgjN7ZpyOw60Zi6csRawWhK1jUb YFXfXcmqkK8qJ0E61iXs4COqTz7YmI/WRt/IyLgIqfNDST3i33k33n/Di050YW7dzQthWKMjw r2G1Qff5MROU5l6c+AkmxmLHxYma2/2dGsBtHt3cat+G49aZT/jPdsBTr9pedjXCk1Mgv7UpG irpn0pRNNFBgeMgA0eJHg4bASer6HCKyWRPpaR/W8KVdUJfatwmgZzEHxAxHGfJCN9jJ2/pNb sm+ME85etWGXPoYjcJ6e6p1jtsMMZqCGmY/EZe5NxPaoVtm91j1cqNLZQulLYX2N8LOaZco Cc: kernel-janitors@vger.kernel.org, LKML X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 26 Nov 2017 10:56:46 +0100 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/video/fbdev/sm501fb.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index f38e3773ccc0..313acc83bb71 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -1484,7 +1484,7 @@ static int sm501_init_cursor(struct fb_info *fbi, unsigned int reg_base) struct sm501fb_info *info; int ret; - if (fbi == NULL) + if (!fbi) return 0; par = fbi->par; @@ -1532,7 +1532,7 @@ static int sm501fb_start(struct sm501fb_info *info, /* allocate, reserve and remap resources for display * controller registers */ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { + if (!res) { dev_err(dev, "no resource definition for registers\n"); ret = -ENOENT; goto err_release; @@ -1541,15 +1541,14 @@ static int sm501fb_start(struct sm501fb_info *info, info->regs_res = request_mem_region(res->start, resource_size(res), pdev->name); - - if (info->regs_res == NULL) { + if (!info->regs_res) { dev_err(dev, "cannot claim registers\n"); ret = -ENXIO; goto err_release; } info->regs = ioremap(res->start, resource_size(res)); - if (info->regs == NULL) { + if (!info->regs) { dev_err(dev, "cannot remap registers\n"); ret = -ENXIO; goto err_regs_res; @@ -1558,7 +1557,7 @@ static int sm501fb_start(struct sm501fb_info *info, /* allocate, reserve and remap resources for 2d * controller registers */ res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (res == NULL) { + if (!res) { dev_err(dev, "no resource definition for 2d registers\n"); ret = -ENOENT; goto err_regs_map; @@ -1567,15 +1566,14 @@ static int sm501fb_start(struct sm501fb_info *info, info->regs2d_res = request_mem_region(res->start, resource_size(res), pdev->name); - - if (info->regs2d_res == NULL) { + if (!info->regs2d_res) { dev_err(dev, "cannot claim registers\n"); ret = -ENXIO; goto err_regs_map; } info->regs2d = ioremap(res->start, resource_size(res)); - if (info->regs2d == NULL) { + if (!info->regs2d) { dev_err(dev, "cannot remap registers\n"); ret = -ENXIO; goto err_regs2d_res; @@ -1583,7 +1581,7 @@ static int sm501fb_start(struct sm501fb_info *info, /* allocate, reserve resources for framebuffer */ res = platform_get_resource(pdev, IORESOURCE_MEM, 2); - if (res == NULL) { + if (!res) { dev_err(dev, "no memory resource defined\n"); ret = -ENXIO; goto err_regs2d_map; @@ -1592,14 +1590,14 @@ static int sm501fb_start(struct sm501fb_info *info, info->fbmem_res = request_mem_region(res->start, resource_size(res), pdev->name); - if (info->fbmem_res == NULL) { + if (!info->fbmem_res) { dev_err(dev, "cannot claim framebuffer\n"); ret = -ENXIO; goto err_regs2d_map; } info->fbmem = ioremap(res->start, resource_size(res)); - if (info->fbmem == NULL) { + if (!info->fbmem) { dev_err(dev, "cannot remap framebuffer\n"); ret = -ENXIO; goto err_mem_res; @@ -1862,13 +1860,13 @@ static int sm501fb_probe_one(struct sm501fb_info *info, pd = (head == HEAD_CRT) ? info->pdata->fb_crt : info->pdata->fb_pnl; /* Do not initialise if we've not been given any platform data */ - if (pd == NULL) { + if (!pd) { dev_info(info->dev, "no data for fb %s (disabled)\n", name); return 0; } fbi = framebuffer_alloc(sizeof(struct sm501fb_par), info->dev); - if (fbi == NULL) { + if (!fbi) { dev_err(info->dev, "cannot allocate %s framebuffer\n", name); return -ENOMEM; } @@ -1944,7 +1942,7 @@ static int sm501fb_probe(struct platform_device *pdev) info->pdata = pd->fb; } - if (info->pdata == NULL) { + if (!info->pdata) { int found = 0; #if defined(CONFIG_OF) struct device_node *np = pdev->dev.parent->of_node; @@ -1987,8 +1985,7 @@ static int sm501fb_probe(struct platform_device *pdev) goto err_probed_crt; } - if (info->fb[HEAD_PANEL] == NULL && - info->fb[HEAD_CRT] == NULL) { + if (!info->fb[HEAD_PANEL] && !info->fb[HEAD_CRT]) { dev_err(dev, "no framebuffers found\n"); ret = -ENODEV; goto err_alloc;