mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Fabien Dessenne <fabien.dessenne@st.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Ludovic Barre <ludovic.barre@st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>
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>,
	Michal Simek <michal.simek@amd.com>
Subject: [PATCH] mailbox: stm32-ipcc: Use devm_clk_get_enabled() in stm32_ipcc_probe()
Date: Sun, 22 Nov 2026 18:54:09 +0100	[thread overview]
Message-ID: <d3e781aa-04e6-4643-bb39-beb4dcfe9b33@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Nov 2026 18:42:21 +0100

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

* Omit a clk_disable_unprepare() call on an error handling path.

* Delete the label “err_clk”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mailbox/stm32-ipcc.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index e88e198436a6..25d8138a3695 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -242,29 +242,21 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 	ipcc->reg_proc = ipcc->reg_base + ipcc->proc_id * IPCC_PROC_OFFST;
 
 	/* clock */
-	ipcc->clk = devm_clk_get(dev, NULL);
+	ipcc->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(ipcc->clk))
 		return PTR_ERR(ipcc->clk);
 
-	ret = clk_prepare_enable(ipcc->clk);
-	if (ret) {
-		dev_err(dev, "can not enable the clock\n");
-		return ret;
-	}
-
 	/* irq */
 	for (i = 0; i < IPCC_IRQ_NUM; i++) {
 		ipcc->irqs[i] = platform_get_irq_byname(pdev, irq_name[i]);
-		if (ipcc->irqs[i] < 0) {
-			ret = ipcc->irqs[i];
-			goto err_clk;
-		}
+		if (ipcc->irqs[i] < 0)
+			return ipcc->irqs[i];
 
 		ret = devm_request_threaded_irq(dev, ipcc->irqs[i], NULL,
 						irq_thread[i], IRQF_ONESHOT,
 						dev_name(dev), ipcc);
 		if (ret)
-			goto err_clk;
+			return ret;
 	}
 
 	/* mask and enable rx/tx irq */
@@ -323,8 +315,6 @@ static int stm32_ipcc_probe(struct platform_device *pdev)
 		dev_pm_clear_wake_irq(dev);
 err_init_wkp:
 	device_set_wakeup_capable(dev, false);
-err_clk:
-	clk_disable_unprepare(ipcc->clk);
 	return ret;
 }
 
-- 
2.56.1


                 reply	other threads:[~2026-11-22 17:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=d3e781aa-04e6-4643-bb39-beb4dcfe9b33@web.de \
    --to=markus.elfring@web.de \
    --cc=Frank.Li@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=f.fainelli@gmail.com \
    --cc=fabien.dessenne@st.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=ludovic.barre@st.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=michal.simek@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®