Re: [PATCH 25/25] media: i2c: ccs-core: fix pm_runtime_get_sync() usage count

From: Mauro Carvalho Chehab
Date: Wed May 05 2021 - 10:06:53 EST


Hi Jonathan,

Em Wed, 5 May 2021 13:35:48 +0100
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> escreveu:

> > > [PATCH] media: i2c: ccs-core: fix pm_runtime_get_sync() usage count
> > >
> > > The pm_runtime_get_sync() internally increments the
> > > dev->power.usage_count without decrementing it, even on errors.
> > >
> > > There is a bug at ccs_pm_get_init(): when this function returns
> > > an error, the stream is not started, and RPM usage_count
> > > should not be incremented. However, if the calls to
> > > v4l2_ctrl_handler_setup() return errors, it will be kept
> > > incremented.
> > >
> > > At ccs_suspend() the best is to replace it by the new
> > > pm_runtime_resume_and_get(), introduced by:
> > > commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
> > > in order to properly decrement the usage counter automatically,
> > > in the case of errors.
> > >
> > > Fixes: 96e3a6b92f23 ("media: smiapp: Avoid maintaining power state information")
> > > Cc: stable@xxxxxxxxxxxxxxx
> > > Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

Per Sakari's request (for practical reasons on backporting and
c/c stable), this was split into two separate patches, one
fixing the issues, and a separate trivial one with just the
pm_runtime_resume_and_get(). I'm adding your RB on both.

Thanks,
Mauro