Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp171667pxu; Thu, 3 Dec 2020 23:46:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3tJTvIbnGRtTUO0rgOPzJJxZD6FHqMHM7THpC1a/BJGtx3Mhyigqtqxz1Y5gr8Fnj8kYQ X-Received: by 2002:a17:906:7f95:: with SMTP id f21mr6151935ejr.340.1607067972838; Thu, 03 Dec 2020 23:46:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607067972; cv=none; d=google.com; s=arc-20160816; b=YM7Sbhyq7N1YFA1cV1w1FMP9+sKrC9H2OhZkkS9KLTRPvqZ54QdeArk6ATVh4hLczL W5OhzA5KLD98vkFlyYcRB4VZQNzcYl9frHXDUsp/Egxylimk/mV+rqUv/U14bexYo2GC 3DCQAlJnxHWF/7vKT3QfRnr5p04CsY2AqJKWnZqutK/0xlFSKrs4BlFb5JlhwFQbG7iJ vVtCw+zs1J5X3v3+LBOltMugvphc9wa7zZTtNf/dyijVOyHA6t8Wer5967SBcFHfTMPC wbTSl8JLlGzG6aKSL4wPuaGIVk1bVQ7iHweqMjJ9aTfZEsDrY5uk5xi4+7Cbp7DYyxa/ P0yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=AEtEwgUTd6bwqi8oiKssKn/WdC6Du7dfaZYYjoT3LM0=; b=x34CcqWZCHWQ65zVURDlIyk2V83Jg72nUGGgtJ3VQKWtRRWZA4u8pulwxF33YPTgM0 GVBdJkjQPeNubTYm5ItjPdsmexbQCGGB6A7PcO4qECLJ5L38bGhD/bM1PwWiaoRKAEYr frnkAECISyysXNToFYLWtpeQj9A6Ti1mE4QbIq+Z1IXh1wTVtVJx3Q+BRR7v1Kq9x8RL 8CRTsCcIMF0blw9eQ+pCKxbhbpztDS5widmu9Ntij9pVSBo1xf18pfVyeonkJ+x28FI3 UbRGvlci+6bIIpBuc3c7WeK/sorGXR2mMFDyQCgcV3hDQaB6uLF4m3Nm6umhw24MgUWr v/3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si3015411edi.490.2020.12.03.23.45.50; Thu, 03 Dec 2020 23:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728470AbgLDHmG (ORCPT + 99 others); Fri, 4 Dec 2020 02:42:06 -0500 Received: from smtp21.cstnet.cn ([159.226.251.21]:39346 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727007AbgLDHmG (ORCPT ); Fri, 4 Dec 2020 02:42:06 -0500 Received: from localhost.localdomain (unknown [124.16.141.242]) by APP-01 (Coremail) with SMTP id qwCowABX9o0a6MlfsIDYAA--.25775S2; Fri, 04 Dec 2020 15:41:14 +0800 (CST) From: Xu Wang To: kblaiech@nvidia.com Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: mlxbf: Fix an error pointer vs NULL check Date: Fri, 4 Dec 2020 07:41:11 +0000 Message-Id: <20201204074111.1359-1-vulab@iscas.ac.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: qwCowABX9o0a6MlfsIDYAA--.25775S2 X-Coremail-Antispam: 1UD129KBjvJXoWrtF13Ar1DtFyfArWftrW8Zwb_yoW8Jryfpr 4ruFZ0k345KrW2qwsrX3Z5XFyYywnxtay0krW8uwsI9Fs8JrWDZF1rAFWj9r4SyrZ5uw45 tF90yFW3CFWUZw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkYb7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4 A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IE w4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r4j6F4UMc vjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCY02Avz4vE14v_GF4l42xK82IY c2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1Y6r17MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0x vE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2 jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU0UGYPUUUUU== X-Originating-IP: [124.16.141.242] X-CM-SenderInfo: pyxotu46lvutnvoduhdfq/1tbiCwkAA1z4joXwngAAsA Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Xu Wang --- drivers/i2c/busses/i2c-mlxbf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 33574d40ea9c..73a58beb7b82 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -1258,9 +1258,9 @@ static int mlxbf_i2c_get_gpio(struct platform_device *pdev, return -EFAULT; gpio_res->io = devm_ioremap(dev, params->start, size); - if (IS_ERR(gpio_res->io)) { + if (!gpio_res->io) { devm_release_mem_region(dev, params->start, size); - return PTR_ERR(gpio_res->io); + return -ENOMEM; } return 0; @@ -1323,9 +1323,9 @@ static int mlxbf_i2c_get_corepll(struct platform_device *pdev, return -EFAULT; corepll_res->io = devm_ioremap(dev, params->start, size); - if (IS_ERR(corepll_res->io)) { + if (!corepll_res->io) { devm_release_mem_region(dev, params->start, size); - return PTR_ERR(corepll_res->io); + return -ENOMEM; } return 0; -- 2.17.1