Skip to contentSkip to conversation

rtc: Add check for clk_enable()

PATCH New Mingwei Zheng 1 participant 1 message Dec 6, 2024 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: Add check for clk_enable()

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()")
---
 drivers/rtc/rtc-spear.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rtc/rtc-spear.c +4 -2
index 26eed927f8b3..064d46b2f16e 100644
@@ -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);
 	}
 
Signature · 1 line
2.34.1