All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Onur Özkan" <work@onurozkan.dev>
To: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: mturquette@baylibre.com, sboyd@kernel.org, bmasney@redhat.com,
	"Onur Özkan" <work@onurozkan.dev>
Subject: [PATCH] clk: devres: make clock cleanup explicit on failure
Date: Fri,  4 Sep 2026 10:50:16 +0300	[thread overview]
Message-ID: <20260904075026.60793-1-work@onurozkan.dev> (raw)

Use devm_add_action() and explicitly disable and unprepare the clock if
registering the action fails to avoid smatch warning.

Link: https://lore.kernel.org/all/apmUPdYtdIM0dQbF@redhat.com
Closes: https://lore.kernel.org/r/202608090025.dwxdfqFr-lkp@intel.com
Signed-off-by: Onur Özkan <work@onurozkan.dev>
---
 drivers/clk/clk-devres.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
index 4cc3863bd7da..9ed9a7b7b23f 100644
--- a/drivers/clk/clk-devres.c
+++ b/drivers/clk/clk-devres.c
@@ -123,9 +123,11 @@ struct clk *devm_clk_get_optional_enabled_with_rate(struct device *dev,
 	if (ret)
 		goto out_put_clk;
 
-	ret = devm_add_action_or_reset(dev, devm_clk_disable_unprepare, clk);
-	if (ret)
+	ret = devm_add_action(dev, devm_clk_disable_unprepare, clk);
+	if (ret) {
+		clk_disable_unprepare(clk);
 		goto out_put_clk;
+	}
 
 	return clk;
 
-- 
2.51.2


             reply	other threads:[~2026-09-04  7:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  7:50 Onur Özkan [this message]
2026-09-04  8:01 ` [PATCH] clk: devres: make clock cleanup explicit on failure sashiko-bot
2026-09-04  8:12   ` Jerome Brunet

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=20260904075026.60793-1-work@onurozkan.dev \
    --to=work@onurozkan.dev \
    --cc=bmasney@redhat.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    /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.