]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: venus: Fix probe error handling
authorLoic Poulain <loic.poulain@oss.qualcomm.com>
Thu, 27 Mar 2025 12:53:04 +0000 (13:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:05:24 +0000 (11:05 +0100)
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: 08b1cf474b7f7 ("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>
drivers/media/platform/qcom/venus/core.c

index de4c351eed0100a79e0e2346d2347791cce1a698..021cd9313e5a946e73c5f66d2bc4c9d5174e54e0 100644 (file)
@@ -333,7 +333,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);
 
@@ -365,24 +365,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:
@@ -393,9 +393,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);