]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: qcom: camss: cleanup media device allocated resource on error path
authorVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Tue, 13 May 2025 14:23:45 +0000 (17:23 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:31:01 +0000 (16:31 +0200)
commit 69080ec3d0daba8a894025476c98ab16b5a505a4 upstream.

A call to media_device_init() requires media_device_cleanup() counterpart
to complete cleanup and release any allocated resources.

This has been done in the driver .remove() right from the beginning, but
error paths on .probe() shall also be fixed.

Fixes: a1d7c116fcf7 ("media: camms: Add core files")
Cc: stable@vger.kernel.org
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.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/camss/camss.c

index 8c3bce738f2a8fbbe2e924c0098092f85fb9e712..d00475d1bc571a75ad04e95bf9b21dcc5d8f1d01 100644 (file)
@@ -2275,7 +2275,7 @@ static int camss_probe(struct platform_device *pdev)
        ret = v4l2_device_register(camss->dev, &camss->v4l2_dev);
        if (ret < 0) {
                dev_err(dev, "Failed to register V4L2 device: %d\n", ret);
-               goto err_genpd_cleanup;
+               goto err_media_device_cleanup;
        }
 
        v4l2_async_nf_init(&camss->notifier, &camss->v4l2_dev);
@@ -2330,6 +2330,8 @@ err_v4l2_device_unregister:
        v4l2_device_unregister(&camss->v4l2_dev);
        v4l2_async_nf_cleanup(&camss->notifier);
        pm_runtime_disable(dev);
+err_media_device_cleanup:
+       media_device_cleanup(&camss->media_dev);
 err_genpd_cleanup:
        camss_genpd_cleanup(camss);