diff mbox series

media: smiapp: Fix runtime PM imbalance on error

Message ID 20200522090313.10634-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New, archived
Headers show
Series media: smiapp: Fix runtime PM imbalance on error | expand

Commit Message

Dinghao Liu May 22, 2020, 9:03 a.m. UTC
When v4l2_async_register_subdev_sensor_common() returns
an error code, a pairing runtime PM usage counter
decrement is needed to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/i2c/smiapp/smiapp-core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Sakari Ailus May 25, 2020, 8:09 a.m. UTC | #1
Hi Dinghao,

Thanks for the patch.

On Fri, May 22, 2020 at 05:03:13PM +0800, Dinghao Liu wrote:
> When v4l2_async_register_subdev_sensor_common() returns
> an error code, a pairing runtime PM usage counter
> decrement is needed to keep the counter balanced.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> index 5e4f6a2ef78e..43ba63c48a87 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -3103,6 +3103,7 @@ static int smiapp_probe(struct i2c_client *client)
>  	return 0;
>  
>  out_disable_runtime_pm:
> +	pm_runtime_put_autosuspend(&client->dev);

Can you use pm_runtime_put_noidle(), as the device musn't be powered off
here yet?

>  	pm_runtime_disable(&client->dev);
>  
>  out_media_entity_cleanup:
Dinghao Liu May 25, 2020, 8:14 a.m. UTC | #2
> Hi Dinghao,
> 
> Thanks for the patch.
> 
> On Fri, May 22, 2020 at 05:03:13PM +0800, Dinghao Liu wrote:
> > When v4l2_async_register_subdev_sensor_common() returns
> > an error code, a pairing runtime PM usage counter
> > decrement is needed to keep the counter balanced.
> > 
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >  drivers/media/i2c/smiapp/smiapp-core.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
> > index 5e4f6a2ef78e..43ba63c48a87 100644
> > --- a/drivers/media/i2c/smiapp/smiapp-core.c
> > +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> > @@ -3103,6 +3103,7 @@ static int smiapp_probe(struct i2c_client *client)
> >  	return 0;
> >  
> >  out_disable_runtime_pm:
> > +	pm_runtime_put_autosuspend(&client->dev);
> 
> Can you use pm_runtime_put_noidle(), as the device musn't be powered off
> here yet?
> 
> >  	pm_runtime_disable(&client->dev);
> >  
> >  out_media_entity_cleanup:
> 
> -- 
> Regards,
> 
> Sakari Ailus

OK. I will fix this in the next version of patch.

Regards,
Dinghao
diff mbox series

Patch

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 5e4f6a2ef78e..43ba63c48a87 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -3103,6 +3103,7 @@  static int smiapp_probe(struct i2c_client *client)
 	return 0;
 
 out_disable_runtime_pm:
+	pm_runtime_put_autosuspend(&client->dev);
 	pm_runtime_disable(&client->dev);
 
 out_media_entity_cleanup: