Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] media: smiapp: Fix runtime PM imbalance on error
@ 2020-05-22  9:03 Dinghao Liu
  2020-05-25  8:09 ` Sakari Ailus
  0 siblings, 1 reply; 3+ messages in thread
From: Dinghao Liu @ 2020-05-22  9:03 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Sakari Ailus, Mauro Carvalho Chehab, linux-media, linux-kernel

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);
 	pm_runtime_disable(&client->dev);
 
 out_media_entity_cleanup:
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: smiapp: Fix runtime PM imbalance on error
  2020-05-22  9:03 [PATCH] media: smiapp: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-05-25  8:09 ` Sakari Ailus
  2020-05-25  8:14   ` dinghao.liu
  0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2020-05-25  8:09 UTC (permalink / raw)
  To: Dinghao Liu; +Cc: kjlu, Mauro Carvalho Chehab, linux-media, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] media: smiapp: Fix runtime PM imbalance on error
  2020-05-25  8:09 ` Sakari Ailus
@ 2020-05-25  8:14   ` dinghao.liu
  0 siblings, 0 replies; 3+ messages in thread
From: dinghao.liu @ 2020-05-25  8:14 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: kjlu, Mauro Carvalho Chehab, linux-media, linux-kernel

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  9:03 [PATCH] media: smiapp: Fix runtime PM imbalance on error Dinghao Liu
2020-05-25  8:09 ` Sakari Ailus
2020-05-25  8:14   ` dinghao.liu

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org
	public-inbox-index linux-media

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git