FAILED: patch "[PATCH] mfd: sm501: Fix potential memory leaks during 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 83feedd9d83c0c5199f98c72df0a6196b4aefb4d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090351-moistness-unmoral-5211@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 83feedd9d83c0c5199f98c72df0a6196b4aefb4d Mon Sep 17 00:00:00 2001
From: Abdun Nihaal <[email protected]>
Date: Mon, 20 Jul 2026 17:08:32 +0530
Subject: [PATCH] mfd: sm501: Fix potential memory leaks during remove
The memory allocated for struct sm501_devdata in sm501_pci_probe() and sm501_plat_probe() is not freed by the corresponding remove functions sm501_pci_remove() and sm501_plat_remove(). Fix that by adding a call to kfree().
drivers/mfd/sm501.c +2 -0
@@ -1627,6 +1627,7 @@ static void sm501_pci_remove(struct pci_dev *dev)release_mem_region (sm->io_res->start,0x100 );pci_disable_device (dev); +kfree (sm); }static void sm501_plat_remove (struct platform_device *dev)
@@ -1637,6 +1638,7 @@ static void sm501_plat_remove(struct platform_device *dev)iounmap (sm->regs);release_mem_region (sm->io_res->start,0x100 ); +kfree (sm); }static const struct pci_device_id sm501_pci_tbl[] = {
Sasha Levin
maintainerPATCH 1/2 mfd: sm501: Convert to platform remove callback returning void
From: Uwe Kleine-König <[email protected]>
[ Upstream commit c20fddf7acfb54d856c34208926701d32c25eb18 ]
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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: 83feedd9d83c ("mfd: sm501: Fix potential memory leaks during remove")
--- drivers/mfd/sm501.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/mfd/sm501.c +2 -4
@@ -1669,7 +1669,7 @@ static void sm501_pci_remove(struct pci_dev *dev)pci_disable_device (dev); } -static int sm501_plat_remove (struct platform_device *dev) +static void sm501_plat_remove (struct platform_device *dev) {struct sm501_devdata *sm =platform_get_drvdata (dev);
@@ -1677,8 +1677,6 @@ static int sm501_plat_remove(struct platform_device *dev)iounmap (sm->regs);release_mem_region (sm->io_res->start,0x100 ); - -return 0 ; }static const struct pci_device_id sm501_pci_tbl[] = {
@@ -1709,7 +1707,7 @@ static struct platform_driver sm501_plat_driver = { .of_match_table = of_sm501_match_tbl, }, .probe = sm501_plat_probe, - .remove = sm501_plat_remove, + .remove_new = sm501_plat_remove, .suspend = pm_sleep_ptr(sm501_plat_suspend), .resume = pm_sleep_ptr(sm501_plat_resume), };
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 mfd: sm501: Fix potential memory leaks during remove
From: Abdun Nihaal <[email protected]>
[ Upstream commit 83feedd9d83c0c5199f98c72df0a6196b4aefb4d ]
The memory allocated for struct sm501_devdata in sm501_pci_probe() and sm501_plat_probe() is not freed by the corresponding remove functions sm501_pci_remove() and sm501_plat_remove(). Fix that by adding a call to kfree().
--- drivers/mfd/sm501.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mfd/sm501.c +2 -0
@@ -1667,6 +1667,7 @@ static void sm501_pci_remove(struct pci_dev *dev)release_mem_region (sm->io_res->start,0x100 );pci_disable_device (dev); +kfree (sm); }static void sm501_plat_remove (struct platform_device *dev)
@@ -1677,6 +1678,7 @@ static void sm501_plat_remove(struct platform_device *dev)iounmap (sm->regs);release_mem_region (sm->io_res->start,0x100 ); +kfree (sm); }static const struct pci_device_id sm501_pci_tbl[] = {
Signature · 1 line
2.53.0