Commit b2bc2200 authored by Wei Yongjun's avatar Wei Yongjun Committed by Martin K. Petersen

scsi: ufs: ufs-exynos: Fix return value check in exynos_ufs_init()

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().

Link: https://lore.kernel.org/r/20200618133837.127274-1-weiyongjun1@huawei.com
Fixes: 55f4b1f7 ("scsi: ufs: ufs-exynos: Add UFS host support for Exynos SoCs")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Acked-by: default avatarAlim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent d31503fe
...@@ -950,25 +950,25 @@ static int exynos_ufs_init(struct ufs_hba *hba) ...@@ -950,25 +950,25 @@ static int exynos_ufs_init(struct ufs_hba *hba)
/* exynos-specific hci */ /* exynos-specific hci */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vs_hci"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vs_hci");
ufs->reg_hci = devm_ioremap_resource(dev, res); 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"); dev_err(dev, "cannot ioremap for hci vendor register\n");
return -ENOMEM; return PTR_ERR(ufs->reg_hci);
} }
/* unipro */ /* unipro */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "unipro"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "unipro");
ufs->reg_unipro = devm_ioremap_resource(dev, res); 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"); dev_err(dev, "cannot ioremap for unipro register\n");
return -ENOMEM; return PTR_ERR(ufs->reg_unipro);
} }
/* ufs protector */ /* ufs protector */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ufsp"); res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ufsp");
ufs->reg_ufsp = devm_ioremap_resource(dev, res); 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"); 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); ret = exynos_ufs_parse_dt(dev, ufs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment