]> 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>
Sat, 23 Aug 2025 04:23:52 +0000 (00:23 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:57 +0000 (16:22 +0200)
[ Upstream commit 69080ec3d0daba8a894025476c98ab16b5a505a4 ]

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>
[ err_genpd_cleanup => err_cleanup ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/qcom/camss/camss.c

index d074f426980dd5c27351e645b4dc3d77ec7baa4b..a4d3cb61b9d0446eec4e2c5aac527d477061f743 100644 (file)
@@ -888,7 +888,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_cleanup;
+               goto err_media_device_cleanup;
        }
 
        ret = camss_register_entities(camss);
@@ -945,6 +945,8 @@ err_register_subdevs:
        camss_unregister_entities(camss);
 err_register_entities:
        v4l2_device_unregister(&camss->v4l2_dev);
+err_media_device_cleanup:
+       media_device_cleanup(&camss->media_dev);
 err_cleanup:
        v4l2_async_notifier_cleanup(&camss->notifier);
 err_free: