Skip to content

Commit d9dcdb4

Browse files
Uwe Kleine-Königbjorn-helgaas
authored andcommitted
PCI: host-generic: Convert to platform remove callback returning void
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. pci_host_common_remove() returned zero unconditionally. With that converted to return void instead, the generic pci host driver can be switched to .remove_new() trivially. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Acked-by: Will Deacon <[email protected]>
1 parent b85ea95 commit d9dcdb4

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

drivers/pci/controller/pci-host-common.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,14 @@ int pci_host_common_probe(struct platform_device *pdev)
8585
}
8686
EXPORT_SYMBOL_GPL(pci_host_common_probe);
8787

88-
int pci_host_common_remove(struct platform_device *pdev)
88+
void pci_host_common_remove(struct platform_device *pdev)
8989
{
9090
struct pci_host_bridge *bridge = platform_get_drvdata(pdev);
9191

9292
pci_lock_rescan_remove();
9393
pci_stop_root_bus(bridge->bus);
9494
pci_remove_root_bus(bridge->bus);
9595
pci_unlock_rescan_remove();
96-
97-
return 0;
9896
}
9997
EXPORT_SYMBOL_GPL(pci_host_common_remove);
10098

drivers/pci/controller/pci-host-generic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static struct platform_driver gen_pci_driver = {
8282
.of_match_table = gen_pci_of_match,
8383
},
8484
.probe = pci_host_common_probe,
85-
.remove = pci_host_common_remove,
85+
.remove_new = pci_host_common_remove,
8686
};
8787
module_platform_driver(gen_pci_driver);
8888

include/linux/pci-ecam.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,6 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
9393
#if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
9494
/* for DT-based PCI controllers that support ECAM */
9595
int pci_host_common_probe(struct platform_device *pdev);
96-
int pci_host_common_remove(struct platform_device *pdev);
96+
void pci_host_common_remove(struct platform_device *pdev);
9797
#endif
9898
#endif

0 commit comments

Comments
 (0)