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: 11612135 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F096138C for ; Thu, 18 Jun 2020 13:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 501FF2082F for ; Thu, 18 Jun 2020 13:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbgFRNfO (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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@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 Acked-by: Alim Akhtar --- 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);