mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
@ 2026-02-24 10:07 Felix Gu
  2026-02-24 11:20 ` Andreas Kemnade
  2026-02-26 12:27 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Gu @ 2026-02-24 10:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Andreas Kemnade; +Cc: linux-kernel, Felix Gu

In fp9931_hwmon_read(), if regmap_read() failed, the function returned
the error code without calling pm_runtime_put_autosuspend(), causing
a PM reference leak.

Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/regulator/fp9931.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/fp9931.c b/drivers/regulator/fp9931.c
index 7fbcc6327cc6..abea3b69d8a0 100644
--- a/drivers/regulator/fp9931.c
+++ b/drivers/regulator/fp9931.c
@@ -144,13 +144,12 @@ static int fp9931_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
 		return ret;
 
 	ret = regmap_read(data->regmap, FP9931_REG_TMST_VALUE, &val);
-	if (ret)
-		return ret;
+	if (!ret)
+		*temp = (s8)val * 1000;
 
 	pm_runtime_put_autosuspend(data->dev);
-	*temp = (s8)val * 1000;
 
-	return 0;
+	return ret;
 }
 
 static umode_t fp9931_hwmon_is_visible(const void *data,

---
base-commit: 779cae956c8316aebc1946ef86ca001f99658270
change-id: 20260224-fp9931-e4142f2e1ab1

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>


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

* Re: [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
  2026-02-24 10:07 [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read() Felix Gu
@ 2026-02-24 11:20 ` Andreas Kemnade
  2026-02-26 12:27 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Kemnade @ 2026-02-24 11:20 UTC (permalink / raw)
  To: Felix Gu; +Cc: Liam Girdwood, Mark Brown, linux-kernel

On Tue, 24 Feb 2026 18:07:59 +0800
Felix Gu <ustc.gu@gmail.com> wrote:

> In fp9931_hwmon_read(), if regmap_read() failed, the function returned
> the error code without calling pm_runtime_put_autosuspend(), causing
> a PM reference leak.
> 
> Fixes: 12d821bd13d4 ("regulator: Add FP9931/JD9930 driver")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Reviewed-by: Andreas Kemnade <andreas@kemnade.info>

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

* Re: [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
  2026-02-24 10:07 [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read() Felix Gu
  2026-02-24 11:20 ` Andreas Kemnade
@ 2026-02-26 12:27 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-02-26 12:27 UTC (permalink / raw)
  To: Liam Girdwood, Andreas Kemnade, Felix Gu; +Cc: linux-kernel

On Tue, 24 Feb 2026 18:07:59 +0800, Felix Gu wrote:
> In fp9931_hwmon_read(), if regmap_read() failed, the function returned
> the error code without calling pm_runtime_put_autosuspend(), causing
> a PM reference leak.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read()
      commit: 0902010c8d163f7b62e655efda1a843529152c7c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2026-02-26 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-24 10:07 [PATCH] regulator: fp9931: Fix PM runtime reference leak in fp9931_hwmon_read() Felix Gu
2026-02-24 11:20 ` Andreas Kemnade
2026-02-26 12:27 ` Mark Brown

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®