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: 11612137 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 F355D138C for ; Thu, 18 Jun 2020 13:35:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 D1E38207D8 for ; Thu, 18 Jun 2020 13:35:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kv6O8NZu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1E38207D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: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=EiasdRzHE7tkbLalLD4PDu850JcaBIxQTekozRa2iF4=; b=kv6O8NZuD9zPkc OP3d+ac/n9uFO67dgX2kVsKtOXy8AKv0djdmd1ri3Iq918RgclYC3IHyJ5O9Ltgh5HUCayE905ukg 7/6IStK9h4JquIdS+FMuwmRcYXbIF0cS4FqqDTIJuDvBvCIX3KROUe1W7mHnFN1YWFVPLclt81STC UJcLkNUJnsmmaSoJHmy/gVDYhIhFlw9YexfW6TPREyd1bS8GxjioSJrOhPJYwRpI+EbjT36fJ2p2d KZG+VSuFdvidDExb9lH6o6OyJR0fVJ9yOpfO+AsvakOTgOwLknSVngP2BLZqRGYM8lL9uQKfe3ccO qKyRQa/U6VaD0Mtm7YiQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jluhJ-0006mv-O3; Thu, 18 Jun 2020 13:35:17 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jluhF-0006Bv-UW for linux-arm-kernel@lists.infradead.org; Thu, 18 Jun 2020 13:35:15 +0000 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" 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200618_063514_155418_8CC1FDC5 X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.35 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [45.249.212.35 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org, Hulk Robot , Wei Yongjun , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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);