From patchwork Thu Jun 18 13:38:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 213301 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=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 3FD01C433E0 for ; Thu, 18 Jun 2020 13:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25D5A20776 for ; Thu, 18 Jun 2020 13:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730193AbgFRNfO (ORCPT ); Thu, 18 Jun 2020 09:35:14 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:42944 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726940AbgFRNfN (ORCPT ); Thu, 18 Jun 2020 09:35:13 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id B642BECFB37E2950F84A; Thu, 18 Jun 2020 21:35:06 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Thu, 18 Jun 2020 21:34:59 +0800 From: Wei Yongjun To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Kukjin Kim , "Krzysztof Kozlowski" , Kiwoong Kim , "Seungwon Jeon" CC: Wei Yongjun , , , , , Hulk Robot Subject: [PATCH -next] scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init() Date: Thu, 18 Jun 2020 13:38:37 +0000 Message-ID: <20200618133837.127274-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 55f4b1f73631 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs") Reported-by: Hulk Robot Signed-off-by: Wei Yongjun --- drivers/scsi/ufs/ufs-exynos.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index 440f2af83d9c..c918fbc6ca60 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -950,25 +950,25 @@ static int exynos_ufs_init(struct ufs_hba *hba) /* exynos-specific hci */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vs_hci"); ufs->reg_hci = devm_ioremap_resource(dev, res); - if (!ufs->reg_hci) { + if (IS_ERR(ufs->reg_hci)) { dev_err(dev, "cannot ioremap for hci vendor register\n"); - return -ENOMEM; + return PTR_ERR(ufs->reg_hci); } /* unipro */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "unipro"); ufs->reg_unipro = devm_ioremap_resource(dev, res); - if (!ufs->reg_unipro) { + if (IS_ERR(ufs->reg_unipro)) { dev_err(dev, "cannot ioremap for unipro register\n"); - return -ENOMEM; + return PTR_ERR(ufs->reg_unipro); } /* ufs protector */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ufsp"); ufs->reg_ufsp = devm_ioremap_resource(dev, res); - if (!ufs->reg_ufsp) { + if (IS_ERR(ufs->reg_ufsp)) { dev_err(dev, "cannot ioremap for ufs protector register\n"); - return -ENOMEM; + return PTR_ERR(ufs->reg_ufsp); } ret = exynos_ufs_parse_dt(dev, ufs);