Skip to content

Commit 9a285fb

Browse files
Uwe Kleine-Königkwilczynski
authored andcommitted
PCI: hisi-error: 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 221879c commit 9a285fb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pci/controller/pcie-hisi-error.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,11 @@ static int hisi_pcie_error_handler_probe(struct platform_device *pdev)
299299
return 0;
300300
}
301301

302-
static int hisi_pcie_error_handler_remove(struct platform_device *pdev)
302+
static void hisi_pcie_error_handler_remove(struct platform_device *pdev)
303303
{
304304
struct hisi_pcie_error_private *priv = platform_get_drvdata(pdev);
305305

306306
ghes_unregister_vendor_record_notifier(&priv->nb);
307-
308-
return 0;
309307
}
310308

311309
static const struct acpi_device_id hisi_pcie_acpi_match[] = {
@@ -319,7 +317,7 @@ static struct platform_driver hisi_pcie_error_handler_driver = {
319317
.acpi_match_table = hisi_pcie_acpi_match,
320318
},
321319
.probe = hisi_pcie_error_handler_probe,
322-
.remove = hisi_pcie_error_handler_remove,
320+
.remove_new = hisi_pcie_error_handler_remove,
323321
};
324322
module_platform_driver(hisi_pcie_error_handler_driver);
325323

0 commit comments

Comments
 (0)