FAILED: patch "[PATCH] media: qcom: camss: cleanup media device allocated resource" failed to apply to 5.15-stable tree
Subsystems (5)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 69080ec3d0daba8a894025476c98ab16b5a505a4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025082155-riches-diaper-55d5@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 69080ec3d0daba8a894025476c98ab16b5a505a4 Mon Sep 17 00:00:00 2001
From: Vladimir Zapolskiy <[email protected]>
Date: Tue, 13 May 2025 17:23:45 +0300
Subject: [PATCH] media: qcom: camss: cleanup media device allocated resource
on error path
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.
drivers/media/platform/qcom/camss/camss.c +3 -1
@@ -3625,7 +3625,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);
@@ -3680,6 +3680,8 @@ static int camss_probe(struct platform_device *pdev)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);
Sasha Levin
maintainerPATCH 1/2 media: camss: Convert to platform remove callback returning void
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 428bbf4be4018aefa26e4d6531779fa8925ecaaf ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void.
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: 69080ec3d0da ("media: qcom: camss: cleanup media device allocated resource on error path")
--- drivers/media/platform/qcom/camss/camss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/qcom/camss/camss.c +2 -4
@@ -1477,7 +1477,7 @@ void camss_delete(struct camss *camss)* * Always returns 0. */ -static int camss_remove (struct platform_device *pdev) +static void camss_remove (struct platform_device *pdev) {struct camss *camss =platform_get_drvdata (pdev);
@@ -1487,8 +1487,6 @@ static int camss_remove(struct platform_device *pdev)if (atomic_read (&camss->ref_count) ==0 )camss_delete (camss); - -return 0 ; }static const struct of_device_id camss_dt_match[] = {
@@ -1519,7 +1517,7 @@ static const struct dev_pm_ops camss_pm_ops = {static struct platform_driver qcom_camss_driver = { .probe = camss_probe, - .remove = camss_remove, + .remove_new = camss_remove, .driver = { .name ="qcom-camss" , .of_match_table = camss_dt_match,
Signature · 1 line
2.50.1
Sasha Levin
maintainerPATCH 2/2 media: qcom: camss: cleanup media device allocated resource on error path
[ 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.
--- drivers/media/platform/qcom/camss/camss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/camss/camss.c +3 -1
@@ -1396,7 +1396,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_cleanup; } ret =camss_register_entities (camss);
@@ -1438,6 +1438,8 @@ static int camss_probe(struct platform_device *pdev)camss_unregister_entities (camss); err_register_entities:v4l2_device_unregister (&camss->v4l2_dev); +err_media_cleanup: +media_device_cleanup (&camss->media_dev); err_cleanup:v4l2_async_notifier_cleanup (&camss->notifier); err_free:
Signature · 1 line
2.50.1