From: "Li Youhong" <dayou5941@163.com>
To: wafgo01@gmail.com, jic23@kernel.org
Cc: maxwell@maxwelld.cc, dlechner@baylibre.com, nuno.sa@analog.com,
andy@kernel.org, linux-iio@vger.kernel.org,
Li Youhong <liyouhong@kylinos.cn>
Subject: [PATCH] iio: flow: slf3s: disable regulator if measurement restart fails
Date: Tue, 1 Sep 2026 10:50:10 +0800 [thread overview]
Message-ID: <20260901025010.356735-1-dayou5941@163.com> (raw)
From: Li Youhong <liyouhong@kylinos.cn>
slf3s_resume() enables the vdd regulator and then starts continuous
measurement. If slf3s_start_meas() fails, resume returns an error
while leaving the regulator enabled. Disable vdd on that path so a
failed resume does not leave the supply on.
Fixes: d240b0b8a1ce ("iio: flow: add Sensirion SLF3S liquid flow sensor driver")
Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
---
drivers/iio/flow/slf3s.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/flow/slf3s.c b/drivers/iio/flow/slf3s.c
index dfa7c1409045..9b63ceb3768a 100644
--- a/drivers/iio/flow/slf3s.c
+++ b/drivers/iio/flow/slf3s.c
@@ -487,7 +487,11 @@ static int slf3s_resume(struct device *dev)
fsleep(SLF3S_POWER_UP_DELAY_US);
- return slf3s_start_meas(sf, sf->medium);
+ ret = slf3s_start_meas(sf, sf->medium);
+ if (ret)
+ regulator_disable(sf->vdd);
+
+ return ret;
}
static DEFINE_SIMPLE_DEV_PM_OPS(slf3s_pm_ops, slf3s_suspend, slf3s_resume);
--
2.25.1
reply other threads:[~2026-09-01 2:50 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=20260901025010.356735-1-dayou5941@163.com \
--to=dayou5941@163.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=liyouhong@kylinos.cn \
--cc=maxwell@maxwelld.cc \
--cc=nuno.sa@analog.com \
--cc=wafgo01@gmail.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