Skip to content

Commit 6f1c0a0

Browse files
Uwe Kleine-Königkwilczynski
authored andcommitted
PCI: iproc: 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. The iproc driver always returns 0, it's just a bit hidden. So make iproc_pcie_remove() return void instead of always zero and convert the platform driver to the alternative remove callback that returns void and eventually replaces the int returning callback. Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Acked-by: Florian Fainelli <[email protected]>
1 parent 9a285fb commit 6f1c0a0

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

drivers/pci/controller/pcie-iproc-platform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev)
114114
return 0;
115115
}
116116

117-
static int iproc_pltfm_pcie_remove(struct platform_device *pdev)
117+
static void iproc_pltfm_pcie_remove(struct platform_device *pdev)
118118
{
119119
struct iproc_pcie *pcie = platform_get_drvdata(pdev);
120120

121-
return iproc_pcie_remove(pcie);
121+
iproc_pcie_remove(pcie);
122122
}
123123

124124
static void iproc_pltfm_pcie_shutdown(struct platform_device *pdev)
@@ -134,7 +134,7 @@ static struct platform_driver iproc_pltfm_pcie_driver = {
134134
.of_match_table = of_match_ptr(iproc_pcie_of_match_table),
135135
},
136136
.probe = iproc_pltfm_pcie_probe,
137-
.remove = iproc_pltfm_pcie_remove,
137+
.remove_new = iproc_pltfm_pcie_remove,
138138
.shutdown = iproc_pltfm_pcie_shutdown,
139139
};
140140
module_platform_driver(iproc_pltfm_pcie_driver);

drivers/pci/controller/pcie-iproc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
15371537
}
15381538
EXPORT_SYMBOL(iproc_pcie_setup);
15391539

1540-
int iproc_pcie_remove(struct iproc_pcie *pcie)
1540+
void iproc_pcie_remove(struct iproc_pcie *pcie)
15411541
{
15421542
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
15431543

@@ -1548,8 +1548,6 @@ int iproc_pcie_remove(struct iproc_pcie *pcie)
15481548

15491549
phy_power_off(pcie->phy);
15501550
phy_exit(pcie->phy);
1551-
1552-
return 0;
15531551
}
15541552
EXPORT_SYMBOL(iproc_pcie_remove);
15551553

drivers/pci/controller/pcie-iproc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct iproc_pcie {
111111
};
112112

113113
int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res);
114-
int iproc_pcie_remove(struct iproc_pcie *pcie);
114+
void iproc_pcie_remove(struct iproc_pcie *pcie);
115115
int iproc_pcie_shutdown(struct iproc_pcie *pcie);
116116

117117
#ifdef CONFIG_PCIE_IPROC_MSI

0 commit comments

Comments
 (0)