Commit dafa3605 authored by Dinghao Liu's avatar Dinghao Liu Committed by Mauro Carvalho Chehab
Browse files

media: platform: s3c-camif: Fix runtime PM imbalance on error



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: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: default avatarSylwester Nawrocki <snawrocki@kernel.org>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent d912a1d9
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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);