]> 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:07:27 +0000 (11:07 +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 46277a9be05a62cf62c780fac00aada1f60984a8..4db7a5d1de726dc34842750e8389b385d56a2064 100644 (file)
@@ -347,7 +347,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);
 
@@ -379,24 +379,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:
@@ -407,9 +407,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);