mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akshat Rawat <akshatrawat095@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: David Lechner <dlechner@baylibre.com>,
	Nuno Sa <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-iio@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Akshat Rawat <akshatrawat095@gmail.com>
Subject: [PATCH] iio: adc: rockchip_saradc: disable vref on resume failure
Date: Fri,  4 Dec 2026 11:12:37 +0000	[thread overview]
Message-ID: <20261204111238.425-1-akshatrawat095@gmail.com> (raw)

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


             reply	other threads:[~2026-12-04 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:12 Akshat Rawat [this message]
2026-12-04 20:28 ` Arnav Kapoor

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=20261204111238.425-1-akshatrawat095@gmail.com \
    --to=akshatrawat095@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=heiko@sntech.de \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=nuno.sa@analog.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®