Re: [PATCH] iio: light: isl29028: fix runtime PM reference leak on error paths
From: Jonathan Cameron
Date: Sun Sep 06 2026 - 22:12:31 EST
On Mon, 7 Sep 2026 00:15:17 +0200
Fabio Cesari <fabio.cesari@xxxxxxxxx> wrote:
> Hi Jonathan,
>
> On Sun, 6 Sep 2026 18:43:58 +0100
> Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> > Whilst perhaps not best practice as such, it is pretty
> > common to just not bother checking the return of pm_runtime_put_autosuspend()
> > at least partly because of that annoying -ENOSYS result if runtime pm isn't
> > enabled. That is what happens with the ACQUIRE macros for instance.
> >
> > Do we have any particular reason to thing it is more likely to fail i this
> > case than any other?
>
> No reason: both functions already returned that value to userspace before the
> patch, and I left that unchanged only because the patch was aimed at the leak.
> It makes sense to fix it as well.
>
> v2 will take the reference with PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND() in
> both functions, as Joshua Crofts suggested, so the value goes away along with
> the manual put.
Why the if enabled variant? I think that only makes sense in places that can
be hit prior to runtime pm being up and running. Maybe that's true here.
>
> Thanks for the review. v2 follows shortly.
>
> Fabio