Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christophe JAILLET and committed by
Mauro Carvalho Chehab
8cc7a1b2 e4debea9

+6 -2
+6 -2
drivers/media/platform/qcom/venus/core.c
··· 350 350 351 351 ret = venus_firmware_init(core); 352 352 if (ret) 353 - goto err_runtime_disable; 353 + goto err_of_depopulate; 354 354 355 355 ret = venus_boot(core); 356 356 if (ret) 357 - goto err_runtime_disable; 357 + goto err_firmware_deinit; 358 358 359 359 ret = hfi_core_resume(core, true); 360 360 if (ret) ··· 386 386 v4l2_device_unregister(&core->v4l2_dev); 387 387 err_venus_shutdown: 388 388 venus_shutdown(core); 389 + err_firmware_deinit: 390 + venus_firmware_deinit(core); 391 + err_of_depopulate: 392 + of_platform_depopulate(dev); 389 393 err_runtime_disable: 390 394 pm_runtime_put_noidle(dev); 391 395 pm_runtime_set_suspended(dev);