Skip to contentSkip to conversation

FAILED: patch "[PATCH] PCI: keystone: Don't discard .remove() callback" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Nov 22, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-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-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x 200bddbb3f5202bbce96444fdc416305de14f547
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023112236-scone-stinking-706f@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..

Possible dependencies:

200bddbb3f52 ("PCI: keystone: Don't discard .remove() callback") 49229238ab47 ("PCI: keystone: Cleanup PHY handling")
b51a625b784a ("PCI: keystone: Use SYSCON APIs to get device ID from control module") b492aca35c98 ("PCI: keystone: Merge pci-keystone-dw.c and pci-keystone.c") 1f79f98f0575 ("PCI: keystone: Remove unused argument from ks_dw_pcie_host_init()") 00a2c4094f8e ("PCI: keystone: Use quirk to set MRRS for PCI host bridge") 6e0832fa432e ("PCI: Collect all native drivers under drivers/pci/controller/") e52d38f4abf4 ("Merge branch 'lorenzo/pci/rockchip'")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 200bddbb3f5202bbce96444fdc416305de14f547 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <[email protected]>
Date: Sun, 1 Oct 2023 19:02:53 +0200
Subject: [PATCH] PCI: keystone: Don't discard .remove() callback
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With CONFIG_PCIE_KEYSTONE=y and ks_pcie_remove() marked with __exit, the function is discarded from the driver. In this case a bound device can still get unbound, e.g via sysfs. Then no cleanup code is run resulting in resource leaks or worse.

The right thing to do is do always have the remove callback available. Note that this driver cannot be compiled as a module, so ks_pcie_remove() was always discarded before this change and modpost couldn't warn about this issue. Furthermore the __ref annotation also prevents a warning.

Fixes 0c4ffcfe1fbc ("PCI: keystone: Add TI Keystone PCIe driver")
drivers/pci/controller/dwc/pci-keystone.c +2 -2
index 49aea6ce3e87..eb3fa17b243f 100644
@@ -1302,7 +1302,7 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int __exit ks_pcie_remove(struct platform_device *pdev)
+static int ks_pcie_remove(struct platform_device *pdev)
 {
 	struct keystone_pcie *ks_pcie = platform_get_drvdata(pdev);
 	struct device_link **link = ks_pcie->link;
@@ -1320,7 +1320,7 @@ static int __exit ks_pcie_remove(struct platform_device *pdev)
 
 static struct platform_driver ks_pcie_driver __refdata = {
 	.probe  = ks_pcie_probe,
-	.remove = __exit_p(ks_pcie_remove),
+	.remove = ks_pcie_remove,
 	.driver = {
 		.name	= "keystone-pcie",
 		.of_match_table = ks_pcie_of_match,