Skip to content

Commit 3064ef2

Browse files
Uwe Kleine-Königbjorn-helgaas
authored andcommitted
PCI: kirin: Don't discard .remove() callback
With CONFIG_PCIE_KIRIN=y and kirin_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. This fixes the following warning by modpost: drivers/pci/controller/dwc/pcie-kirin: section mismatch in reference: kirin_pcie_driver+0x8 (section: .data) -> kirin_pcie_remove (section: .exit.text) (with ARCH=x86_64 W=1 allmodconfig). Fixes: 000f60d ("PCI: kirin: Add support for a PHY layer") Link: https://lore.kernel.org/r/20231001170254.2506508-3-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: stable@vger.kernel.org
1 parent 83a939f commit 3064ef2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/pci/controller/dwc/pcie-kirin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static int kirin_pcie_power_on(struct platform_device *pdev,
741741
return ret;
742742
}
743743

744-
static int __exit kirin_pcie_remove(struct platform_device *pdev)
744+
static int kirin_pcie_remove(struct platform_device *pdev)
745745
{
746746
struct kirin_pcie *kirin_pcie = platform_get_drvdata(pdev);
747747

@@ -818,7 +818,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
818818

819819
static struct platform_driver kirin_pcie_driver = {
820820
.probe = kirin_pcie_probe,
821-
.remove = __exit_p(kirin_pcie_remove),
821+
.remove = kirin_pcie_remove,
822822
.driver = {
823823
.name = "kirin-pcie",
824824
.of_match_table = kirin_pcie_match,

0 commit comments

Comments
 (0)