[PATCH] rtc: Add check for clk_enable()

From: Mingwei Zheng
Date: Fri Dec 06 2024 - 17:21:41 EST


Add check for the return value of clk_enable() to catch the potential
error.

Fixes: 0c4eae66591a ("rtc: convert drivers/rtc/* to use module_platform_driver()")
Signed-off-by: Mingwei Zheng <zmw12306@xxxxxxxxx>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@xxxxxxxxx>
---
drivers/rtc/rtc-spear.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 26eed927f8b3..064d46b2f16e 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -437,7 +437,7 @@ static int spear_rtc_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct spear_rtc_config *config = platform_get_drvdata(pdev);
- int irq;
+ int irq, ret;

irq = platform_get_irq(pdev, 0);

@@ -447,7 +447,9 @@ static int spear_rtc_resume(struct device *dev)
config->irq_wake = 0;
}
} else {
- clk_enable(config->clk);
+ ret = clk_enable(config->clk);
+ if (ret)
+ return ret;
spear_rtc_enable_interrupt(config);
}

--
2.34.1