mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: rockchip_saradc: disable vref on resume failure
@ 2026-12-04 11:12 Akshat Rawat
  2026-12-04 20:28 ` Arnav Kapoor
  0 siblings, 1 reply; 2+ messages in thread
From: Akshat Rawat @ 2026-12-04 11:12 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: David Lechner, Nuno Sa, Andy Shevchenko, Heiko Stuebner,
	linux-iio, linux-rockchip, linux-arm-kernel, linux-kernel,
	Akshat Rawat

In rockchip_saradc_resume(), info->vref is enabled before preparing and
enabling info->pclk and info->clk. If enabling either clock fails, the
error paths return without disabling info->vref, leaving its enable
count unbalanced.

Add an error unwind path to disable info->pclk (when enabling info->clk
fails) and info->vref, matching rockchip_saradc_suspend().

Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
Signed-off-by: Akshat Rawat <akshatrawat095@gmail.com>
---

Compile-tested (x86_64 gcc 15.2.0, W=1, CONFIG_WERROR=y) with
CONFIG_PM_SLEEP=y and CONFIG_PM=n; not tested on hardware.

 drivers/iio/adc/rockchip_saradc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 5c45fae11890..f2f901017359 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -613,12 +613,18 @@ static int rockchip_saradc_resume(struct device *dev)
 
 	ret = clk_prepare_enable(info->pclk);
 	if (ret)
-		return ret;
+		goto err_disable_vref;
 
 	ret = clk_prepare_enable(info->clk);
 	if (ret)
-		clk_disable_unprepare(info->pclk);
+		goto err_disable_pclk;
+
+	return 0;
 
+err_disable_pclk:
+	clk_disable_unprepare(info->pclk);
+err_disable_vref:
+	regulator_disable(info->vref);
 	return ret;
 }
 

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.56.1.windows.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04 20:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-04 11:12 [PATCH] iio: adc: rockchip_saradc: disable vref on resume failure Akshat Rawat
2026-12-04 20:28 ` Arnav Kapoor

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®