提交 8cc7a1b2 编写于 作者: C Christophe JAILLET 提交者: Mauro Carvalho Chehab

media: venus: core: Fix a resource leak in the error handling path of 'venus_probe()'

A successful 'of_platform_populate()' call should be balanced by a
corresponding 'of_platform_depopulate()' call in the error handling path
of the probe, as already done in the remove function.

A successful 'venus_firmware_init()' call should be balanced by a
corresponding 'venus_firmware_deinit()' call in the error handling path
of the probe, as already done in the remove function.

Update the error handling path accordingly.

Fixes: f9799fcc ("media: venus: firmware: register separate platform_device for firmware loader")
Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: NStanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 e4debea9
...@@ -350,11 +350,11 @@ static int venus_probe(struct platform_device *pdev) ...@@ -350,11 +350,11 @@ static int venus_probe(struct platform_device *pdev)
ret = venus_firmware_init(core); ret = venus_firmware_init(core);
if (ret) if (ret)
goto err_runtime_disable; goto err_of_depopulate;
ret = venus_boot(core); ret = venus_boot(core);
if (ret) if (ret)
goto err_runtime_disable; goto err_firmware_deinit;
ret = hfi_core_resume(core, true); ret = hfi_core_resume(core, true);
if (ret) if (ret)
...@@ -386,6 +386,10 @@ static int venus_probe(struct platform_device *pdev) ...@@ -386,6 +386,10 @@ static int venus_probe(struct platform_device *pdev)
v4l2_device_unregister(&core->v4l2_dev); v4l2_device_unregister(&core->v4l2_dev);
err_venus_shutdown: err_venus_shutdown:
venus_shutdown(core); venus_shutdown(core);
err_firmware_deinit:
venus_firmware_deinit(core);
err_of_depopulate:
of_platform_depopulate(dev);
err_runtime_disable: err_runtime_disable:
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册