Re: [PATCH] iio: light: gp2ap002: Fix runtime PM leak in gp2ap002_read_raw()
From: Jonathan Cameron
Date: Wed Sep 16 2026 - 20:39:25 EST
On Wed, 16 Sep 2026 19:34:56 +0200
Linus Walleij <linusw@xxxxxxxxxx> wrote:
> On Wed, Sep 16, 2026 at 6:37 PM Wentao Liang <vulab@xxxxxxxxxxx> wrote:
>
> > pm_runtime_get_sync() increments the usage counter even on failure,
> > so every successful call must be paired with a put. A failure of
> > gp2ap002_get_lux() returned early and skipped the paired
> > pm_runtime_put_autosuspend(), permanently preventing runtime
> > suspend. Jump to the common exit that releases the reference.
> >
> > Fixes: f6dbf83c17cb ("iio: light: gp2ap002: Take runtime PM reference on light read")
> > Cc: stable@xxxxxxxxxxxxxxx
>
> IMO not stable material.
Also that's not what upstream looks like:
https://elixir.bootlin.com/linux/v7.2.5/source/drivers/iio/light/gp2ap002.c#L246
Wentao, that function would definitely benefit form use of the
ACQUIRE macros in pm_runtime.h though if you do want to
improve it.
>
> > Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
>
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>
>
> Yours,
> Linus Walleij