* [PATCH] iio: proximity: srf04: fix error handling in srf04_probe()
@ 2026-08-19 19:03 Salah Triki
2026-08-20 1:58 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2026-08-19 19:03 UTC (permalink / raw)
To: Andreas Klinger, Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko
Cc: linux-iio, linux-kernel, Salah Triki
If pm_runtime_set_active() fails during srf04_probe(),
iio_device_unregister() is called to cleanup, but the driver continues to
execute pm_runtime_enable() and pm_runtime_idle() instead of aborting
probe.
Fix this by returning 'ret' immediately inside the error path if
pm_runtime_set_active() fails, preventing invalid runtime PM operations on
an unregistered device.
Fixes: 2251157b335b ("iio: srf04: add power management feature")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/iio/proximity/srf04.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
index 7be50bdebfcb..e03f3f0dee04 100644
--- a/drivers/iio/proximity/srf04.c
+++ b/drivers/iio/proximity/srf04.c
@@ -330,6 +330,7 @@ static int srf04_probe(struct platform_device *pdev)
if (ret) {
dev_err(data->dev, "pm_runtime_set_active: %d\n", ret);
iio_device_unregister(indio_dev);
+ return ret;
}
pm_runtime_enable(data->dev);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: proximity: srf04: fix error handling in srf04_probe()
2026-08-19 19:03 [PATCH] iio: proximity: srf04: fix error handling in srf04_probe() Salah Triki
@ 2026-08-20 1:58 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-08-20 1:58 UTC (permalink / raw)
To: Salah Triki
Cc: Andreas Klinger, David Lechner, Nuno Sá, Andy Shevchenko,
linux-iio, linux-kernel
On Wed, 19 Aug 2026 20:03:17 +0100
Salah Triki <salah.triki@gmail.com> wrote:
> If pm_runtime_set_active() fails during srf04_probe(),
> iio_device_unregister() is called to cleanup, but the driver continues to
> execute pm_runtime_enable() and pm_runtime_idle() instead of aborting
> probe.
>
> Fix this by returning 'ret' immediately inside the error path if
> pm_runtime_set_active() fails, preventing invalid runtime PM operations on
> an unregistered device.
>
> Fixes: 2251157b335b ("iio: srf04: add power management feature")
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
Fixed a few weeks back.
Thanks
Jonathan
> ---
> drivers/iio/proximity/srf04.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c
> index 7be50bdebfcb..e03f3f0dee04 100644
> --- a/drivers/iio/proximity/srf04.c
> +++ b/drivers/iio/proximity/srf04.c
> @@ -330,6 +330,7 @@ static int srf04_probe(struct platform_device *pdev)
> if (ret) {
> dev_err(data->dev, "pm_runtime_set_active: %d\n", ret);
> iio_device_unregister(indio_dev);
> + return ret;
> }
>
> pm_runtime_enable(data->dev);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-20 1:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 19:03 [PATCH] iio: proximity: srf04: fix error handling in srf04_probe() Salah Triki
2026-08-20 1:58 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox