aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/qcom/venus
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2021-08-19 22:05:28 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-11-30 12:31:18 +0100
commit8cc7a1b2aca067397a016cdb971a5e6ad9b640c7 (patch)
treede0300f753d528881a1ba4df39f738a22f746e87 /drivers/media/platform/qcom/venus
parentmedia: venus: core: Fix a potential NULL pointer dereference in an error handling path (diff)
downloadlinux-dev-8cc7a1b2aca067397a016cdb971a5e6ad9b640c7.tar.xz
linux-dev-8cc7a1b2aca067397a016cdb971a5e6ad9b640c7.zip
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: f9799fcce4bb ("media: venus: firmware: register separate platform_device for firmware loader") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/qcom/venus')
-rw-r--r--drivers/media/platform/qcom/venus/core.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index fd32385485fa..877eca125803 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -350,11 +350,11 @@ static int venus_probe(struct platform_device *pdev)
ret = venus_firmware_init(core);
if (ret)
- goto err_runtime_disable;
+ goto err_of_depopulate;
ret = venus_boot(core);
if (ret)
- goto err_runtime_disable;
+ goto err_firmware_deinit;
ret = hfi_core_resume(core, true);
if (ret)
@@ -386,6 +386,10 @@ err_dev_unregister:
v4l2_device_unregister(&core->v4l2_dev);
err_venus_shutdown:
venus_shutdown(core);
+err_firmware_deinit:
+ venus_firmware_deinit(core);
+err_of_depopulate:
+ of_platform_depopulate(dev);
err_runtime_disable:
pm_runtime_put_noidle(dev);
pm_runtime_set_suspended(dev);