FAILED: patch "[PATCH] wifi: wlcore: Fix runtime PM leak in wlcore_remove()" failed to apply to 6.6-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.6-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-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x a8b8881d0c1aff544fae190469d86db7b07f43a9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026100446-quaintly-establish-1f37@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a8b8881d0c1aff544fae190469d86db7b07f43a9 Mon Sep 17 00:00:00 2001
From: Wentao Liang <[email protected]>
Date: Thu, 17 Sep 2026 12:23:25 +0000
Subject: [PATCH] wifi: wlcore: Fix runtime PM leak in wlcore_remove()
pm_runtime_get_sync() keeps the runtime PM usage counter elevated even when it returns an error, so the reference taken at the beginning of wlcore_remove() has to be dropped on every exit path. When the device was not initialized the function returned early without doing so, leaking the reference.
Release it with pm_runtime_put_noidle() as done on the other early error paths of this driver.
drivers/net/wireless/ti/wlcore/main.c +3 -1
@@ -6809,8 +6809,10 @@ void wlcore_remove(struct platform_device *pdev)if (pdev_data->family && pdev_data->family->nvs_name)wait_for_completion (&wl->nvs_loading_complete); -if (!wl->initialized) +if (!wl->initialized) { +pm_runtime_put_noidle (wl->dev);return ; + }if (wl->wakeirq >=0 ) {dev_pm_clear_wake_irq (wl->dev);
Sasha Levin
maintainerPATCH 1/2 wifi: wlcore: Convert to platform remove callback returning void
From: Uwe Kleine-König <[email protected]>
[ Upstream commit f00928012886a07ca6817ea70eb4856ce280ce05 ]
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.
wlcore_remove() returned zero unconditionally. With that converted to return void instead, the wl12xx and wl18xx driver can be converted to .remove_new trivially.
Stable-dep-of: a8b8881d0c1a ("wifi: wlcore: Fix runtime PM leak in wlcore_remove()")
--- drivers/net/wireless/ti/wl12xx/main.c | 6 +++--- drivers/net/wireless/ti/wl18xx/main.c | 2 +- drivers/net/wireless/ti/wlcore/main.c | 6 ++---- drivers/net/wireless/ti/wlcore/wlcore.h | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-)
drivers/net/wireless/ti/wl12xx/main.c +3 -3
@@ -1919,7 +1919,7 @@ static int wl12xx_probe(struct platform_device *pdev)return ret; } -static int wl12xx_remove (struct platform_device *pdev) +static void wl12xx_remove (struct platform_device *pdev) {struct wl1271 *wl =platform_get_drvdata (pdev);struct wl12xx_priv *priv;
@@ -1928,7 +1928,7 @@ static int wl12xx_remove(struct platform_device *pdev)kfree (priv->rx_mem_addr); -return wlcore_remove (pdev); +wlcore_remove (pdev); }static const struct platform_device_id wl12xx_id_table[] = {
@@ -1939,7 +1939,7 @@ MODULE_DEVICE_TABLE(platform, wl12xx_id_table);static struct platform_driver wl12xx_driver = { .probe = wl12xx_probe, - .remove = wl12xx_remove, + .remove_new = wl12xx_remove, .id_table = wl12xx_id_table, .driver = { .name ="wl12xx_driver" ,
drivers/net/wireless/ti/wl18xx/main.c +1 -1
@@ -2033,7 +2033,7 @@ MODULE_DEVICE_TABLE(platform, wl18xx_id_table);static struct platform_driver wl18xx_driver = { .probe = wl18xx_probe, - .remove = wlcore_remove, + .remove_new = wlcore_remove, .id_table = wl18xx_id_table, .driver = { .name ="wl18xx_driver" ,
drivers/net/wireless/ti/wlcore/main.c +2 -4
@@ -6735,7 +6735,7 @@ int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev) }EXPORT_SYMBOL_GPL (wlcore_probe); -int wlcore_remove (struct platform_device *pdev) +void wlcore_remove (struct platform_device *pdev) {struct wlcore_platdev_data *pdev_data =dev_get_platdata (&pdev->dev);struct wl1271 *wl =platform_get_drvdata (pdev);
@@ -6750,7 +6750,7 @@ int wlcore_remove(struct platform_device *pdev)if (pdev_data->family && pdev_data->family->nvs_name)wait_for_completion (&wl->nvs_loading_complete);if (!wl->initialized) -return 0 ; +return ;if (wl->wakeirq >=0 ) {dev_pm_clear_wake_irq (wl->dev);
@@ -6770,8 +6770,6 @@ int wlcore_remove(struct platform_device *pdev)free_irq (wl->irq, wl);wlcore_free_hw (wl); - -return 0 ; }EXPORT_SYMBOL_GPL (wlcore_remove);
drivers/net/wireless/ti/wlcore/wlcore.h +1 -1
@@ -497,7 +497,7 @@ struct wl1271 { };int wlcore_probe (struct wl1271 *wl,struct platform_device *pdev); -int wlcore_remove (struct platform_device *pdev); +void wlcore_remove (struct platform_device *pdev);struct ieee80211_hw *wlcore_alloc_hw (size_t priv_size,u32 aggr_buf_size,u32 mbox_size);int wlcore_free_hw (struct wl1271 *wl);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 wifi: wlcore: Fix runtime PM leak in wlcore_remove()
From: Wentao Liang <[email protected]>
[ Upstream commit a8b8881d0c1aff544fae190469d86db7b07f43a9 ]
pm_runtime_get_sync() keeps the runtime PM usage counter elevated even when it returns an error, so the reference taken at the beginning of wlcore_remove() has to be dropped on every exit path. When the device was not initialized the function returned early without doing so, leaking the reference.
Release it with pm_runtime_put_noidle() as done on the other early error paths of this driver.
--- drivers/net/wireless/ti/wlcore/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ti/wlcore/main.c +3 -1
@@ -6749,8 +6749,10 @@ void wlcore_remove(struct platform_device *pdev)if (pdev_data->family && pdev_data->family->nvs_name)wait_for_completion (&wl->nvs_loading_complete); -if (!wl->initialized) +if (!wl->initialized) { +pm_runtime_put_noidle (wl->dev);return ; + }if (wl->wakeirq >=0 ) {dev_pm_clear_wake_irq (wl->dev);
Signature · 1 line
2.53.0