* [PATCH] iio: light: bh1780: fix PM runtime leak on error path
@ 2026-01-30 11:30 Antoniu Miclaus
2026-01-30 13:16 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Antoniu Miclaus @ 2026-01-30 11:30 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Antoniu Miclaus, Linus Walleij, Sakari Ailus,
Ulf Hansson, linux-iio, linux-kernel
Move pm_runtime_put_autosuspend() before the error check to ensure
the PM runtime reference count is always decremented after
pm_runtime_get_sync(), regardless of whether the read operation
succeeds or fails.
Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/light/bh1780.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c
index 5d3c6d5276ba..a740d1f992a8 100644
--- a/drivers/iio/light/bh1780.c
+++ b/drivers/iio/light/bh1780.c
@@ -109,9 +109,9 @@ static int bh1780_read_raw(struct iio_dev *indio_dev,
case IIO_LIGHT:
pm_runtime_get_sync(&bh1780->client->dev);
value = bh1780_read_word(bh1780, BH1780_REG_DLOW);
+ pm_runtime_put_autosuspend(&bh1780->client->dev);
if (value < 0)
return value;
- pm_runtime_put_autosuspend(&bh1780->client->dev);
*val = value;
return IIO_VAL_INT;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iio: light: bh1780: fix PM runtime leak on error path
2026-01-30 11:30 [PATCH] iio: light: bh1780: fix PM runtime leak on error path Antoniu Miclaus
@ 2026-01-30 13:16 ` Linus Walleij
2026-01-31 17:05 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2026-01-30 13:16 UTC (permalink / raw)
To: Antoniu Miclaus
Cc: Jonathan Cameron, David Lechner, Nuno Sá,
Andy Shevchenko, Linus Walleij, Sakari Ailus, Ulf Hansson,
linux-iio, linux-kernel
On Fri, Jan 30, 2026 at 12:31 PM Antoniu Miclaus
<antoniu.miclaus@analog.com> wrote:
> Move pm_runtime_put_autosuspend() before the error check to ensure
> the PM runtime reference count is always decremented after
> pm_runtime_get_sync(), regardless of whether the read operation
> succeeds or fails.
>
> Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
This looks right!
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iio: light: bh1780: fix PM runtime leak on error path
2026-01-30 13:16 ` Linus Walleij
@ 2026-01-31 17:05 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-01-31 17:05 UTC (permalink / raw)
To: Linus Walleij
Cc: Antoniu Miclaus, David Lechner, Nuno Sá,
Andy Shevchenko, Linus Walleij, Sakari Ailus, Ulf Hansson,
linux-iio, linux-kernel
On Fri, 30 Jan 2026 14:16:36 +0100
Linus Walleij <linusw@kernel.org> wrote:
> On Fri, Jan 30, 2026 at 12:31 PM Antoniu Miclaus
> <antoniu.miclaus@analog.com> wrote:
>
> > Move pm_runtime_put_autosuspend() before the error check to ensure
> > the PM runtime reference count is always decremented after
> > pm_runtime_get_sync(), regardless of whether the read operation
> > succeeds or fails.
> >
> > Fixes: 1f0477f18306 ("iio: light: new driver for the ROHM BH1780")
> > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
>
> This looks right!
> Reviewed-by: Linus Walleij <linusw@kernel.org>
I've applied this to my local tree for now. Given where we are in the
cycle this likely won't go out until after the merge window when
I have rebased on rc1.
Thanks,
Jonathan
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-31 17:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-30 11:30 [PATCH] iio: light: bh1780: fix PM runtime leak on error path Antoniu Miclaus
2026-01-30 13:16 ` Linus Walleij
2026-01-31 17:05 ` 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®