Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966156AbeAOPQp (ORCPT + 1 other); Mon, 15 Jan 2018 10:16:45 -0500 Received: from mout.web.de ([212.227.15.4]:65245 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965741AbeAOPQn (ORCPT ); Mon, 15 Jan 2018 10:16:43 -0500 Subject: [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers From: SF Markus Elfring To: kernel-janitors@vger.kernel.org, Lee Jones Cc: LKML References: Message-ID: <10199b4b-ba7d-a253-25c5-e81cafb1d8c9@users.sourceforge.net> Date: Mon, 15 Jan 2018 16:16:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:2VYaWr9/EpECSQa/hMo6qaW9YXbwuGQ5dOJy4SUpVs+4r/3rBDg 3voQ+dpAbVJsxTGBoAtCdJsjtA4JJToID/JpAsPemdtubsl2lx69hEEoyczONL58Fik2Hg1 UqODnSEcy+m/OcKr4+SBT5LiZatnHAWJ3uZ39hCahNDzTx/syqFaEH5F8Jw5BAn4dwJofoT wLRzrbG78V4wBARxsj3Wg== X-UI-Out-Filterresults: notjunk:1;V01:K0:Y9dxnjIk8Io=:Fh8igDsTQ8HY3r1Gch7hXY 6M/G91gfCN1t+O9k1uJh3t1w4LxF9rMN7JlByg298Boyy1Kb/+znUdIQ5M7osS7DhkG82SjXE sIbhKTMD3zjGKShR1m5h8WlMi/G80wj62GXNQo62X6y7JsgVCCxLsMITHmYqkFxizjl1dZzfe xee0Nc9w2tHMasc/4EuMbOIQEhzh75wb+qxoDYXwMTDaQOkl1ZjhesftJ2nz38ncNrBKfXTJY 07NmUdpQ0YT5nSJnxp0WSXNDdsLlqiFqiXD1lxgRafXs8CxtdI6QvuQgyEo02SQ/XSxULFn0p UNqr8QrEFEqRGO/yHApKnZQogulu6HPUyK+JeSj+MelbJYU068iYZoC9LF8smGPGkfSu8e61G eG4IjWyvelpSPMQ+XIKdXRZ8tYKLCfxZyBqpg6zqV5LdMHUD42y9ZhNRAVVMEBW23TmFO9YtU ASPElycyAJREsl0dHtNQuPjnsxiCTq2IHAkkDmowBFnSdHzZSmtCCp2X/8StSYbIWmmedjt2G OjRTybsYeAUNX+cTDunWhQqow8vpaovsZv/y9JDY/zrSMaY12fnK6b5VzNDu7siP8Xi35cKaP vT9vvNGUPV7gdUZpgWuAfA1R5MLnpTOzEujHIi9sfVVamrxSdel/BkZkcHvWe0DOxbB2q2yNE IxzzeuZ1Lc+2dE3OSYaoduNd5uxIkoORD9ffHk6Bhnd9NhYUtU/e9VGpOF2gCXCiR9QVRtMBx hCBY5lJ9sfBqOD8t7akGqdwg4QE8mtLnsySSNtEHzWR2mJppo7XWPGIG+bakRDWV0Y2PwUme0 +dM6irQTlRXMOmOgS0WISiVXGixpZkpOIZes9BDseLy8NmVLuQ= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Mon, 15 Jan 2018 16:00:22 +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/mfd/sm501.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index d5ab3481794a..726242f51003 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1050,13 +1050,13 @@ static int sm501_register_gpio(struct sm501_devdata *sm) spin_lock_init(&gpio->lock); gpio->regs_res = request_mem_region(iobase, 0x20, "sm501-gpio"); - if (gpio->regs_res == NULL) { + if (!gpio->regs_res) { dev_err(sm->dev, "gpio: failed to request region\n"); return -ENXIO; } gpio->regs = ioremap(iobase, 0x20); - if (gpio->regs == NULL) { + if (!gpio->regs) { dev_err(sm->dev, "gpio: failed to remap registers\n"); ret = -ENXIO; goto err_claimed; @@ -1358,7 +1358,7 @@ static int sm501_init_dev(struct sm501_devdata *sm) sm501_register_gpio(sm); } - if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) { + if (pdata && pdata->gpio_i2c && pdata->gpio_i2c_nr > 0) { if (!sm501_gpio_isregistered(sm)) dev_err(sm->dev, "no gpio available for i2c gpio.\n"); else @@ -1383,7 +1383,7 @@ static int sm501_plat_probe(struct platform_device *dev) int ret; struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); - if (sm == NULL) { + if (!sm) { ret = -ENOMEM; goto err1; } @@ -1401,8 +1401,7 @@ static int sm501_plat_probe(struct platform_device *dev) sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1); sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0); - - if (sm->io_res == NULL || sm->mem_res == NULL) { + if (!sm->io_res || !sm->mem_res) { dev_err(&dev->dev, "failed to get IO resource\n"); ret = -ENOENT; goto err_res; @@ -1410,8 +1409,7 @@ static int sm501_plat_probe(struct platform_device *dev) sm->regs_claim = request_mem_region(sm->io_res->start, 0x100, "sm501"); - - if (sm->regs_claim == NULL) { + if (!sm->regs_claim) { dev_err(&dev->dev, "cannot claim registers\n"); ret = -EBUSY; goto err_res; @@ -1420,8 +1418,7 @@ static int sm501_plat_probe(struct platform_device *dev) platform_set_drvdata(dev, sm); sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); - - if (sm->regs == NULL) { + if (!sm->regs) { dev_err(&dev->dev, "cannot remap registers\n"); ret = -EIO; goto err_claim; @@ -1447,7 +1444,7 @@ static void sm501_set_power(struct sm501_devdata *sm, int on) { struct sm501_platdata *pd = sm->platdata; - if (pd == NULL) + if (!pd) return; if (pd->get_power) { @@ -1571,7 +1568,7 @@ static int sm501_pci_probe(struct pci_dev *dev, int err; struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL); - if (sm == NULL) { + if (!sm) { err = -ENOMEM; goto err1; } @@ -1622,15 +1619,14 @@ static int sm501_pci_probe(struct pci_dev *dev, sm->regs_claim = request_mem_region(sm->io_res->start, 0x100, "sm501"); - if (sm->regs_claim == NULL) { + if (!sm->regs_claim) { dev_err(&dev->dev, "cannot claim registers\n"); err= -EBUSY; goto err3; } sm->regs = pci_ioremap_bar(dev, 1); - - if (sm->regs == NULL) { + if (!sm->regs) { dev_err(&dev->dev, "cannot remap registers\n"); err = -EIO; goto err4; -- 2.15.1