[PATCH 2/2] rtc: mpc5121: Fix return value of mpc5121_rtc_probe()

From: Tiezhu Yang
Date: Sat May 23 2020 - 05:56:44 EST


When call function devm_platform_ioremap_resource(), we should use IS_ERR()
to check the return value and return PTR_ERR() if failed.

Fixes: d53d4ae981d0 ("rtc: mpc5121: simplify probe")
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
drivers/rtc/rtc-mpc5121.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 3040844..5c2ce71 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -316,7 +316,7 @@ static int mpc5121_rtc_probe(struct platform_device *op)
rtc->regs = devm_platform_ioremap_resource(op, 0);
if (IS_ERR(rtc->regs)) {
dev_err(&op->dev, "%s: couldn't map io space\n", __func__);
- return -ENOSYS;
+ return PTR_ERR(rtc->regs);
}

device_init_wakeup(&op->dev, 1);
--
2.1.0