Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe()
@ 2026-11-23 21:02 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2026-11-23 21:02 UTC (permalink / raw)
  To: linux-rtc, linux-arm-kernel, Alexandre Belloni, Chuhong Yuan,
	Krzysztof Kozlowski, Oleksij Rempel
  Cc: LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 23 Nov 2026 21:50:07 +0100

* Reuse existing functionality from devm_clk_get_enabled() instead of
  keeping duplicate source code.

* Delete a clk_disable_unprepare() call on an error handling path
  and in the implementation of the function “asm9260_rtc_remove”.

* Omit the label “err_return”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/rtc/rtc-asm9260.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
index 95d7b894acd5..38a9bb8b3f9b 100644
--- a/drivers/rtc/rtc-asm9260.c
+++ b/drivers/rtc/rtc-asm9260.c
@@ -261,16 +261,10 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->iobase))
 		return PTR_ERR(priv->iobase);
 
-	priv->clk = devm_clk_get(dev, "ahb");
+	priv->clk = devm_clk_get_enabled(dev, "ahb");
 	if (IS_ERR(priv->clk))
 		return PTR_ERR(priv->clk);
 
-	ret = clk_prepare_enable(priv->clk);
-	if (ret) {
-		dev_err(dev, "Failed to enable clk!\n");
-		return ret;
-	}
-
 	ccr = ioread32(priv->iobase + HW_CCR);
 	/* if dev is not enabled, reset it */
 	if ((ccr & (BM_CLKEN | BM_CTCRST)) != BM_CLKEN) {
@@ -287,7 +281,7 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->rtc)) {
 		ret = PTR_ERR(priv->rtc);
 		dev_err(dev, "Failed to register RTC device: %d\n", ret);
-		goto err_return;
+		return ret;
 	}
 
 	ret = devm_request_threaded_irq(dev, irq_alarm, NULL,
@@ -296,14 +290,10 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
 	if (ret < 0) {
 		dev_err(dev, "can't get irq %i, err %d\n",
 			irq_alarm, ret);
-		goto err_return;
+		return ret;
 	}
 
 	return 0;
-
-err_return:
-	clk_disable_unprepare(priv->clk);
-	return ret;
 }
 
 static void asm9260_rtc_remove(struct platform_device *pdev)
@@ -312,7 +302,6 @@ static void asm9260_rtc_remove(struct platform_device *pdev)
 
 	/* Disable alarm matching */
 	iowrite32(BM_AMR_OFF, priv->iobase + HW_AMR);
-	clk_disable_unprepare(priv->clk);
 }
 
 static const struct of_device_id asm9260_dt_ids[] = {
-- 
2.56.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 21:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 21:02 [PATCH] rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe() Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox