* [PATCH] iio: adc: Fix pm runtime clean-up in sun4i_gpadc_probe
@ 2025-10-08 16:51 Shuhao Fu
2025-10-08 16:57 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Shuhao Fu @ 2025-10-08 16:51 UTC (permalink / raw)
To: Jonathan Cameron, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Cc: David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-arm-kernel, linux-sunxi, linux-kernel
In `sun4i_gpadc_probe`, in case of thermal register failure, the runtime
PM usage counter would not be decreased, resulting in a possible
inconsistency of runtime PM state.
Fixes: b0a242894f11 ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm")
Signed-off-by: Shuhao Fu <sfual@cse.ust.hk>
---
drivers/iio/adc/sun4i-gpadc-iio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 6b8d6bee1873..ae4a59a965b9 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -644,7 +644,8 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"could not register thermal sensor: %ld\n",
PTR_ERR(info->tzd));
- return PTR_ERR(info->tzd);
+ ret = PTR_ERR(info->tzd);
+ goto err_map;
}
}
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: Fix pm runtime clean-up in sun4i_gpadc_probe
2025-10-08 16:51 [PATCH] iio: adc: Fix pm runtime clean-up in sun4i_gpadc_probe Shuhao Fu
@ 2025-10-08 16:57 ` Andy Shevchenko
2025-10-12 17:52 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-10-08 16:57 UTC (permalink / raw)
To: Shuhao Fu
Cc: Jonathan Cameron, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-arm-kernel, linux-sunxi, linux-kernel
On Wed, Oct 8, 2025 at 7:52 PM Shuhao Fu <sfual@cse.ust.hk> wrote:
>
> In `sun4i_gpadc_probe`, in case of thermal register failure, the runtime
> PM usage counter would not be decreased, resulting in a possible
> inconsistency of runtime PM state.
>
> Fixes: b0a242894f11 ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm")
This might fix this problem, but it doesn't fix the whole mess in the
probe with devm/non-devm ordering.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: Fix pm runtime clean-up in sun4i_gpadc_probe
2025-10-08 16:57 ` Andy Shevchenko
@ 2025-10-12 17:52 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2025-10-12 17:52 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Shuhao Fu, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
David Lechner, Nuno Sá, Andy Shevchenko, linux-iio,
linux-arm-kernel, linux-sunxi, linux-kernel
On Wed, 8 Oct 2025 19:57:47 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Wed, Oct 8, 2025 at 7:52 PM Shuhao Fu <sfual@cse.ust.hk> wrote:
> >
> > In `sun4i_gpadc_probe`, in case of thermal register failure, the runtime
> > PM usage counter would not be decreased, resulting in a possible
> > inconsistency of runtime PM state.
> >
> > Fixes: b0a242894f11 ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm")
>
> This might fix this problem, but it doesn't fix the whole mess in the
> probe with devm/non-devm ordering.
>
Mostly this looks simple to fix. Starting with devm_iio_map_register() instead
of the non devm version.
Then devm_pm_runtime_enable(). However, I have no idea why we need a pm_runtime_put()
in the exit path. Maybe it's messing with the parent power? There isn't a matching
get.
Anyone have this hardware to hand for testing if we try to fix this up fully?
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-12 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 16:51 [PATCH] iio: adc: Fix pm runtime clean-up in sun4i_gpadc_probe Shuhao Fu
2025-10-08 16:57 ` Andy Shevchenko
2025-10-12 17:52 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox