From patchwork Wed May 19 14:16:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 12267409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 024BFC433ED for ; Wed, 19 May 2021 14:09:49 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BEEED611AE for ; Wed, 19 May 2021 14:09:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BEEED611AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=eoH91nE78G6desVgA4Zc81U2fU/8euTwmg/hjEsGxrg=; b=FESdVE5sJDBFrKff7X7qd3Pq7y 3jdYHqjE4j6Ndyjj/ZxgOsL5XKqAFj2CkIInaD6/vLmjNWZqsFsfgfEJR1lKUnnjX6B/s/KV+Tfh7 j4GabVVfIRQiwE4KRACUnrm7pq5Rj8vxCR1LO+gqMhXKkXL2UIEcaGiAmv88YxLczdVCcCcvHAm9T R+A7zPJMWcXBLyMbttrWgg38jyYlz3DAqCr3zuFunymneqKCiiFzhgD7UlnDPblLbburLVIH26vbr ujJeDzKxqa3HxHioo+lmNg0Y6249WB6Ys1qXEo1nYF9QIzwmdOFiEjHrJQRciNT1KguAZjxTyst08 AmaUYdOw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljMrM-004D4u-BV; Wed, 19 May 2021 14:07:40 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljMrJ-004D4h-85 for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 14:07:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=MN5wuRLbgrGAgnBqbGgUKaUHDtRoK+ZbYWHnWISj3+0=; b=SjkV41WXs8XasPbblttztPMuen YpM0nR55wFl4aZZrfjzjq+0oKRO8kaioQmYD0oeF6K2wp4nmiMPoKHMMBf+Qx/wQ18z4ThjwXGZmB S92a37AfN06ulXCYoqqJlVYpc076TqxKmQ4JtkTYL0qhujJcs8mKP1TIs9ilTWi/i4dgHr4Zk3Wb2 AW7Xcw4X/VMX5sycXQKJBN9v2Q1Ar8kxpe6QYLVE3+BFaX6CxU25R0d8nLjrYfubEx4y2ZvNSScUf Nfy8ZCuP9cjti9cTcXaUxGrC47wDCxkVeAgDFr6gTIdLGN+eBXoguwqRK9oApltcTryO03AdzyBaB v1IueIpQ==; Received: from szxga06-in.huawei.com ([45.249.212.32]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljMrG-00FWZ2-CH for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 14:07:36 +0000 Received: from dggems703-chm.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FlZPv68v8zmXDq; Wed, 19 May 2021 22:05:07 +0800 (CST) Received: from dggeml759-chm.china.huawei.com (10.1.199.138) by dggems703-chm.china.huawei.com (10.3.19.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 19 May 2021 22:07:23 +0800 Received: from localhost.localdomain (10.175.102.38) by dggeml759-chm.china.huawei.com (10.1.199.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Wed, 19 May 2021 22:07:23 +0800 From: Wei Yongjun To: , Steen Hegelund , Philipp Zabel , Lars Povlsen , Steen Hegelund , CC: , , , Hulk Robot Subject: [PATCH -next] reset: mchp: sparx5: fix return value check in mchp_sparx5_map_io() Date: Wed, 19 May 2021 14:16:37 +0000 Message-ID: <20210519141638.3052456-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.102.38] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeml759-chm.china.huawei.com (10.1.199.138) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_070734_603321_B481FE03 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In case of error, the function devm_platform_get_and_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 453ed4283beb ("reset: mchp: sparx5: add switch reset driver") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/reset/reset-microchip-sparx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c index cff39a643a14..f01e7db8e83b 100644 --- a/drivers/reset/reset-microchip-sparx5.c +++ b/drivers/reset/reset-microchip-sparx5.c @@ -82,9 +82,9 @@ static int mchp_sparx5_map_io(struct platform_device *pdev, int index, void __iomem *mem; mem = devm_platform_get_and_ioremap_resource(pdev, index, &res); - if (!mem) { + if (IS_ERR(mem)) { dev_err(&pdev->dev, "Could not map resource %d\n", index); - return -ENXIO; + return PTR_ERR(mem); } sparx5_reset_regmap_config.name = res->name; map = devm_regmap_init_mmio(&pdev->dev, mem, &sparx5_reset_regmap_config);