mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes
@ 2026-09-06 15:58 Felix Gu
  2026-09-06 15:58 ` [PATCH 1/2] iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls Felix Gu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Felix Gu @ 2026-09-06 15:58 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Quentin Schulz, Maxime Ripard
  Cc: linux-iio, linux-arm-kernel, linux-sunxi, linux-kernel, Felix Gu,
	Jonathan Cameron

Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
Felix Gu (2):
      iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls
      iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure

 drivers/iio/adc/sun4i-gpadc-iio.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
---
base-commit: 9d80aa4617b32f5054c5aa471d06b66704854935
change-id: 20260906-gpadc-d41b964d8f17

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


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

* [PATCH 1/2] iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls
  2026-09-06 15:58 [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Felix Gu
@ 2026-09-06 15:58 ` Felix Gu
  2026-09-06 15:58 ` [PATCH 2/2] iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure Felix Gu
  2026-09-06 17:36 ` [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Felix Gu @ 2026-09-06 15:58 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Quentin Schulz, Maxime Ripard
  Cc: linux-iio, linux-arm-kernel, linux-sunxi, linux-kernel, Felix Gu,
	Jonathan Cameron

Neither the error path in sun4i_gpadc_probe() nor sun4i_gpadc_remove()
ever holds a runtime PM usage count. So the pm_runtime_put() in both
places always triggers the "Runtime PM usage count underflow!" warning
on every failed probe and every unbind.

Drop both calls.

Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 203459ca9907..85382e435f2a 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -657,7 +657,6 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 	if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF))
 		iio_map_array_unregister(indio_dev);
 
-	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	return ret;
@@ -668,7 +667,6 @@ static void sun4i_gpadc_remove(struct platform_device *pdev)
 	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
 	struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
 
-	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
 	if (!IS_ENABLED(CONFIG_THERMAL_OF))

-- 
2.53.0


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

* [PATCH 2/2] iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure
  2026-09-06 15:58 [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Felix Gu
  2026-09-06 15:58 ` [PATCH 1/2] iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls Felix Gu
@ 2026-09-06 15:58 ` Felix Gu
  2026-09-06 17:36 ` [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Felix Gu @ 2026-09-06 15:58 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Quentin Schulz, Maxime Ripard
  Cc: linux-iio, linux-arm-kernel, linux-sunxi, linux-kernel, Felix Gu,
	Jonathan Cameron

If devm_thermal_of_zone_register() fails, probe returns without
unregistering the IIO map array or disabling runtime PM.

Jump to err_map to release them.

Fixes: b0a242894f11 ("iio: adc: sun4i-gpadc-iio: register in the thermal after registering in pm")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/iio/adc/sun4i-gpadc-iio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
index 85382e435f2a..ac5ba76b979e 100644
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
@@ -638,10 +638,10 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
 		 * thermal because no thermal DT node is found.
 		 */
 		if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) {
-			dev_err(&pdev->dev,
-				"could not register thermal sensor: %ld\n",
-				PTR_ERR(info->tzd));
-			return PTR_ERR(info->tzd);
+			ret = dev_err_probe(&pdev->dev,
+					    PTR_ERR(info->tzd),
+					    "could not register thermal sensor\n");
+			goto err_map;
 		}
 	}
 

-- 
2.53.0


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

* Re: [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes
  2026-09-06 15:58 [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Felix Gu
  2026-09-06 15:58 ` [PATCH 1/2] iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls Felix Gu
  2026-09-06 15:58 ` [PATCH 2/2] iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure Felix Gu
@ 2026-09-06 17:36 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-09-06 17:36 UTC (permalink / raw)
  To: Felix Gu
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Quentin Schulz, Maxime Ripard, linux-iio, linux-arm-kernel,
	linux-sunxi, linux-kernel

On Sun, 06 Sep 2026 23:58:33 +0800
Felix Gu <ustc.gu@gmail.com> wrote:

Some text here would be normal even if it doesn't add much!

Anyhow, both fall in the obviously correct category so
I've queued them up on the fixes-togreg branch of iio.git
and marked them for stable.

Thanks,

Jonathan

> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> Felix Gu (2):
>       iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls
>       iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure
> 
>  drivers/iio/adc/sun4i-gpadc-iio.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> ---
> base-commit: 9d80aa4617b32f5054c5aa471d06b66704854935
> change-id: 20260906-gpadc-d41b964d8f17
> 
> Best regards,
> --  
> Felix Gu <ustc.gu@gmail.com>
> 


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

end of thread, other threads:[~2026-09-06 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-06 15:58 [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Felix Gu
2026-09-06 15:58 ` [PATCH 1/2] iio: adc: sun4i-gpadc-iio: drop underflowing pm_runtime_put() calls Felix Gu
2026-09-06 15:58 ` [PATCH 2/2] iio: adc: sun4i-gpadc-iio: clean up on thermal zone registration failure Felix Gu
2026-09-06 17:36 ` [PATCH 0/2] iio: adc: sun4i-gpadc-iio: two fixes Jonathan Cameron

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®