From: Markus Elfring <Markus.Elfring@web.de>
To: linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Chuhong Yuan <hslester96@gmail.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Oleksij Rempel <linux@rempel-privat.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
kernel-janitors@vger.kernel.org,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Christophe Jaillet <christophe.jaillet@wanadoo.fr>,
Florian Fainelli <f.fainelli@gmail.com>,
Frank Li <Frank.Li@kernel.org>
Subject: [PATCH] rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe()
Date: Mon, 23 Nov 2026 22:02:29 +0100 [thread overview]
Message-ID: <ef3d0b97-e1ad-4924-b380-16a46fd17b94@web.de> (raw)
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
next reply other threads:[~2026-11-23 21:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 21:02 Markus Elfring [this message]
2026-11-23 21:05 ` [PATCH] rtc: asm9260: Use devm_clk_get_enabled() in asm9260_rtc_probe() sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef3d0b97-e1ad-4924-b380-16a46fd17b94@web.de \
--to=markus.elfring@web.de \
--cc=Frank.Li@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=f.fainelli@gmail.com \
--cc=hslester96@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux@rempel-privat.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.