Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance on error
@ 2020-05-21 13:29 Dinghao Liu
  2020-05-24 19:15 ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-05-21 13:29 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Sylwester Nawrocki, Mauro Carvalho Chehab, linux-media,
	linux-samsung-soc, linux-kernel

pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced.

Also, call pm_runtime_disable() when pm_runtime_get_sync() returns
an error code.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/media/platform/s3c-camif/camif-core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c
index c6fbcd7036d6..ee624804862e 100644
--- a/drivers/media/platform/s3c-camif/camif-core.c
+++ b/drivers/media/platform/s3c-camif/camif-core.c
@@ -464,7 +464,7 @@ static int s3c_camif_probe(struct platform_device *pdev)
 
 	ret = camif_media_dev_init(camif);
 	if (ret < 0)
-		goto err_alloc;
+		goto err_pm;
 
 	ret = camif_register_sensor(camif);
 	if (ret < 0)
@@ -498,10 +498,9 @@ static int s3c_camif_probe(struct platform_device *pdev)
 	media_device_unregister(&camif->media_dev);
 	media_device_cleanup(&camif->media_dev);
 	camif_unregister_media_entities(camif);
-err_alloc:
+err_pm:
 	pm_runtime_put(dev);
 	pm_runtime_disable(dev);
-err_pm:
 	camif_clk_put(camif);
 err_clk:
 	s3c_camif_unregister_subdev(camif);
-- 
2.17.1


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

* Re: [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance on error
  2020-05-21 13:29 [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance on error Dinghao Liu
@ 2020-05-24 19:15 ` Sylwester Nawrocki
  0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2020-05-24 19:15 UTC (permalink / raw)
  To: Dinghao Liu, kjlu
  Cc: Mauro Carvalho Chehab, linux-media, linux-samsung-soc, linux-kernel

Hi,

On 5/21/20 15:29, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced.
> 
> Also, call pm_runtime_disable() when pm_runtime_get_sync() returns
> an error code.
> 
> Signed-off-by: Dinghao Liu<dinghao.liu@zju.edu.cn>

Thanks for the patch:

Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 13:29 [PATCH] media: platform: s3c-camif: Fix runtime PM imbalance on error Dinghao Liu
2020-05-24 19:15 ` Sylwester Nawrocki

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