[PATCH 08/40] soc/fujitsu: a64fx-diag: Convert to platform remove callback returning void

Uwe Kleine-König posted 40 patches 1 year, 1 month ago
[PATCH 08/40] soc/fujitsu: a64fx-diag: Convert to platform remove callback returning void
Posted by Uwe Kleine-König 1 year, 1 month ago
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 ignored (apart
from emitting a warning) 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. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/soc/fujitsu/a64fx-diag.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/fujitsu/a64fx-diag.c b/drivers/soc/fujitsu/a64fx-diag.c
index 524fbfeb94e3..330901893577 100644
--- a/drivers/soc/fujitsu/a64fx-diag.c
+++ b/drivers/soc/fujitsu/a64fx-diag.c
@@ -116,7 +116,7 @@ static int a64fx_diag_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int a64fx_diag_remove(struct platform_device *pdev)
+static void a64fx_diag_remove(struct platform_device *pdev)
 {
 	struct a64fx_diag_priv *priv = platform_get_drvdata(pdev);
 
@@ -127,8 +127,6 @@ static int a64fx_diag_remove(struct platform_device *pdev)
 		free_nmi(priv->irq, NULL);
 	else
 		free_irq(priv->irq, NULL);
-
-	return 0;
 }
 
 static const struct acpi_device_id a64fx_diag_acpi_match[] = {
@@ -144,7 +142,7 @@ static struct platform_driver a64fx_diag_driver = {
 		.acpi_match_table = ACPI_PTR(a64fx_diag_acpi_match),
 	},
 	.probe = a64fx_diag_probe,
-	.remove = a64fx_diag_remove,
+	.remove_new = a64fx_diag_remove,
 };
 
 module_platform_driver(a64fx_diag_driver);
-- 
2.40.1