[PATCH] mmc: rockchip_sdhci: Correct error checking

From: Haolin Li li.haolin@qq.com
A pointer can not be negative. Use macro IS_ERR_OR_NULL() for checking.
Signed-off-by: Haolin Li li.haolin@qq.com --- drivers/mmc/rockchip_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index f3f9d83ba3..a46895299d 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -227,7 +227,7 @@ static int rk3399_emmc_get_phy(struct udevice *dev) }
grf_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); - if (grf_base < 0) { + if (IS_ERR_OR_NULL(grf_base)) { printf("%s Get syscon grf failed", __func__); return -ENODEV; }

On Tue, 22 Mar 2022 at 06:58, li.haolin@qq.com wrote:
From: Haolin Li li.haolin@qq.com
A pointer can not be negative. Use macro IS_ERR_OR_NULL() for checking.
Signed-off-by: Haolin Li li.haolin@qq.com
drivers/mmc/rockchip_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

Hi Haolin,
Thanks for your patch.
On 2022/3/22 20:58, li.haolin@qq.com wrote:
From: Haolin Li li.haolin@qq.com
A pointer can not be negative. Use macro IS_ERR_OR_NULL() for checking.
Signed-off-by: Haolin Li li.haolin@qq.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
drivers/mmc/rockchip_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index f3f9d83ba3..a46895299d 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -227,7 +227,7 @@ static int rk3399_emmc_get_phy(struct udevice *dev) }
grf_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- if (grf_base < 0) {
- if (IS_ERR_OR_NULL(grf_base)) { printf("%s Get syscon grf failed", __func__); return -ENODEV; }

On 3/22/22 21:58, li.haolin@qq.com wrote:
From: Haolin Li li.haolin@qq.com
A pointer can not be negative. Use macro IS_ERR_OR_NULL() for checking.
Signed-off-by: Haolin Li li.haolin@qq.com
Reviewed-by: Jaehoon Chung jh80.chung@samsung.com
Best Regards, Jaehoon Chung
drivers/mmc/rockchip_sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index f3f9d83ba3..a46895299d 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -227,7 +227,7 @@ static int rk3399_emmc_get_phy(struct udevice *dev) }
grf_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
- if (grf_base < 0) {
- if (IS_ERR_OR_NULL(grf_base)) { printf("%s Get syscon grf failed", __func__); return -ENODEV; }
participants (4)
-
Jaehoon Chung
-
Kever Yang
-
li.haolin@qq.com
-
Simon Glass