Skip to content

Commit 22626c4

Browse files
Uwe Kleine-Königkwilczynski
authored andcommitted
PCI: mediatek-gen3: 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 5e00054 commit 22626c4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pci/controller/pcie-mediatek-gen3.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ static int mtk_pcie_probe(struct platform_device *pdev)
943943
return 0;
944944
}
945945

946-
static int mtk_pcie_remove(struct platform_device *pdev)
946+
static void mtk_pcie_remove(struct platform_device *pdev)
947947
{
948948
struct mtk_gen3_pcie *pcie = platform_get_drvdata(pdev);
949949
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
@@ -955,8 +955,6 @@ static int mtk_pcie_remove(struct platform_device *pdev)
955955

956956
mtk_pcie_irq_teardown(pcie);
957957
mtk_pcie_power_down(pcie);
958-
959-
return 0;
960958
}
961959

962960
static void mtk_pcie_irq_save(struct mtk_gen3_pcie *pcie)
@@ -1069,7 +1067,7 @@ MODULE_DEVICE_TABLE(of, mtk_pcie_of_match);
10691067

10701068
static struct platform_driver mtk_pcie_driver = {
10711069
.probe = mtk_pcie_probe,
1072-
.remove = mtk_pcie_remove,
1070+
.remove_new = mtk_pcie_remove,
10731071
.driver = {
10741072
.name = "mtk-pcie-gen3",
10751073
.of_match_table = mtk_pcie_of_match,

0 commit comments

Comments
 (0)