* [PATCH] clk: devres: make clock cleanup explicit on failure
@ 2026-09-04 7:50 Onur Özkan
0 siblings, 0 replies; only message in thread
From: Onur Özkan @ 2026-09-04 7:50 UTC (permalink / raw)
To: linux-clk, linux-kernel; +Cc: mturquette, sboyd, bmasney, Onur Özkan
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-04 7:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 7:50 [PATCH] clk: devres: make clock cleanup explicit on failure Onur Özkan
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®