media: venus: Fix probe error handling
commit 523cea3a19f0b3b020a4745344c136a636e6ffd7 upstream.
Video device registering has been moved earlier in the probe function,
but the new order has not been propagated to error handling. This means
we can end with unreleased resources on error (e.g dangling video device
on missing firmware probe aborting).
Fixes: 08b1cf474b ("media: venus: core, venc, vdec: Fix probe dependency error")
Cc: stable@vger.kernel.org
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
Reviewed-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2429bb9fad
commit
742c60333b
@@ -354,7 +354,7 @@ static int venus_probe(struct platform_device *pdev)
|
||||
|
||||
ret = v4l2_device_register(dev, &core->v4l2_dev);
|
||||
if (ret)
|
||||
goto err_core_deinit;
|
||||
goto err_hfi_destroy;
|
||||
|
||||
platform_set_drvdata(pdev, core);
|
||||
|
||||
@@ -386,24 +386,24 @@ static int venus_probe(struct platform_device *pdev)
|
||||
|
||||
ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC);
|
||||
if (ret)
|
||||
goto err_venus_shutdown;
|
||||
goto err_core_deinit;
|
||||
|
||||
ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_ENC);
|
||||
if (ret)
|
||||
goto err_venus_shutdown;
|
||||
goto err_core_deinit;
|
||||
|
||||
ret = pm_runtime_put_sync(dev);
|
||||
if (ret) {
|
||||
pm_runtime_get_noresume(dev);
|
||||
goto err_dev_unregister;
|
||||
goto err_core_deinit;
|
||||
}
|
||||
|
||||
venus_dbgfs_init(core);
|
||||
|
||||
return 0;
|
||||
|
||||
err_dev_unregister:
|
||||
v4l2_device_unregister(&core->v4l2_dev);
|
||||
err_core_deinit:
|
||||
hfi_core_deinit(core, false);
|
||||
err_venus_shutdown:
|
||||
venus_shutdown(core);
|
||||
err_firmware_deinit:
|
||||
@@ -414,9 +414,9 @@ err_runtime_disable:
|
||||
pm_runtime_put_noidle(dev);
|
||||
pm_runtime_disable(dev);
|
||||
pm_runtime_set_suspended(dev);
|
||||
v4l2_device_unregister(&core->v4l2_dev);
|
||||
err_hfi_destroy:
|
||||
hfi_destroy(core);
|
||||
err_core_deinit:
|
||||
hfi_core_deinit(core, false);
|
||||
err_core_put:
|
||||
if (core->pm_ops->core_put)
|
||||
core->pm_ops->core_put(core);
|
||||
|
||||
Reference in New Issue
Block a user