Re: [PATCH] media: i2c: gc0308: drop runtime PM reference after probe

From: Sakari Ailus

Date: Tue Sep 15 2026 - 05:58:59 EST


Hi Guangshuo,

Thanks for the patch.

When you do similar kinds of changes to multiple drivers, it's better to
form a patchset of these. There will be several versions of each, please
collect them together for v2. I presume most need changes.

On Tue, Sep 15, 2026 at 04:05:01PM +0800, Guangshuo Li wrote:
> gc0308_probe() powers the sensor manually and takes a runtime PM
> reference with pm_runtime_get_noresume() before enabling runtime PM and
> autosuspend.
>
> The probe error path correctly drops this reference with
> pm_runtime_put_noidle(), but the successful probe path never releases
> it. As a result, the runtime PM usage count remains non-zero for the
> entire lifetime of the bound driver, preventing the sensor from
> runtime-suspending when idle.
>
> Drop the initial runtime PM reference with
> pm_runtime_put_autosuspend() after the V4L2 subdevice has been
> successfully registered. This allows the usage count to reach zero and
> the sensor to enter runtime suspend after the configured autosuspend
> delay.
>
> This issue was found by manual code inspection.
>
> Fixes: 3ae52083b533 ("media: i2c: gc0308: new driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
> ---
> drivers/media/i2c/gc0308.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/i2c/gc0308.c b/drivers/media/i2c/gc0308.c
> index 15900d5414cf..266f737f9c5d 100644
> --- a/drivers/media/i2c/gc0308.c
> +++ b/drivers/media/i2c/gc0308.c
> @@ -1385,6 +1385,7 @@ static int gc0308_probe(struct i2c_client *client)
> dev_err_probe(dev, ret, "failed to register v4l subdev\n");
> goto fail_rpm;
> }
> + pm_runtime_put_autosuspend(dev);

Instead of doing this, drop getting references in probe and remove and call
pm_runtime_idle() here.

>
> return 0;
>

--
Regards,

Sakari Ailus