rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe()
Subsystems (3)
PATCH 1/1 rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe()
From: Markus Elfring <[email protected]>
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.
--- drivers/rtc/rtc-asm9260.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/rtc/rtc-asm9260.c +3 -14
@@ -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[] = {
Signature · 1 line
2.56.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 6 lines
From: Markus Elfring <[email protected]>
Date: Mon, 23 Nov 2026 21:50:07 +0100* Reuse existing functionality from
devm_clk_get_enabled()instead of keeping duplicate source code.
Quoted 8 lines
* 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 <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1