Skip to content

Commit 37af43b

Browse files
jernejskmchehab
authored andcommitted
media: hantro: Fix probe func error path
If clocks for some reason couldn't be enabled, probe function returns immediately, without disabling PM. This obviously leaves PM ref counters unbalanced. Fix that by jumping to appropriate error path, so effects of PM functions are reversed. Fixes: 775fec6 ("media: add Rockchip VPU JPEG encoder driver") Signed-off-by: Jernej Skrabec <[email protected]> Acked-by: Andrzej Pietrasiewicz <[email protected]> Reviewed-by: Ezequiel Garcia <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 69a1874 commit 37af43b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/staging/media/hantro/hantro_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static int hantro_probe(struct platform_device *pdev)
981981
ret = clk_bulk_prepare(vpu->variant->num_clocks, vpu->clocks);
982982
if (ret) {
983983
dev_err(&pdev->dev, "Failed to prepare clocks\n");
984-
return ret;
984+
goto err_pm_disable;
985985
}
986986

987987
ret = v4l2_device_register(&pdev->dev, &vpu->v4l2_dev);
@@ -1037,6 +1037,7 @@ static int hantro_probe(struct platform_device *pdev)
10371037
v4l2_device_unregister(&vpu->v4l2_dev);
10381038
err_clk_unprepare:
10391039
clk_bulk_unprepare(vpu->variant->num_clocks, vpu->clocks);
1040+
err_pm_disable:
10401041
pm_runtime_dont_use_autosuspend(vpu->dev);
10411042
pm_runtime_disable(vpu->dev);
10421043
return ret;

0 commit comments

Comments
 (0)