Skip to content

Commit 5e00054

Browse files
Uwe Kleine-Königkwilczynski
authored andcommitted
PCI: mediatek: 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. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. 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]>
1 parent 6f1c0a0 commit 5e00054

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pci/controller/pcie-mediatek.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ static void mtk_pcie_free_resources(struct mtk_pcie *pcie)
11341134
pci_free_resource_list(windows);
11351135
}
11361136

1137-
static int mtk_pcie_remove(struct platform_device *pdev)
1137+
static void mtk_pcie_remove(struct platform_device *pdev)
11381138
{
11391139
struct mtk_pcie *pcie = platform_get_drvdata(pdev);
11401140
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
@@ -1146,8 +1146,6 @@ static int mtk_pcie_remove(struct platform_device *pdev)
11461146
mtk_pcie_irq_teardown(pcie);
11471147

11481148
mtk_pcie_put_resources(pcie);
1149-
1150-
return 0;
11511149
}
11521150

11531151
static int mtk_pcie_suspend_noirq(struct device *dev)
@@ -1239,7 +1237,7 @@ MODULE_DEVICE_TABLE(of, mtk_pcie_ids);
12391237

12401238
static struct platform_driver mtk_pcie_driver = {
12411239
.probe = mtk_pcie_probe,
1242-
.remove = mtk_pcie_remove,
1240+
.remove_new = mtk_pcie_remove,
12431241
.driver = {
12441242
.name = "mtk-pcie",
12451243
.of_match_table = mtk_pcie_ids,

0 commit comments

Comments
 (0)