[PATCH 4/7] extcon: max3355: Convert to platform remove callback returning void

From: Uwe Kleine-König
Date: Sun Feb 25 2024 - 10:56:14 EST


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@xxxxxxxxxxxxxx>
---
drivers/extcon/extcon-max3355.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/extcon/extcon-max3355.c b/drivers/extcon/extcon-max3355.c
index d7795607f693..e62ce7a8d131 100644
--- a/drivers/extcon/extcon-max3355.c
+++ b/drivers/extcon/extcon-max3355.c
@@ -112,13 +112,11 @@ static int max3355_probe(struct platform_device *pdev)
return 0;
}

-static int max3355_remove(struct platform_device *pdev)
+static void max3355_remove(struct platform_device *pdev)
{
struct max3355_data *data = platform_get_drvdata(pdev);

gpiod_set_value_cansleep(data->shdn_gpiod, 0);
-
- return 0;
}

static const struct of_device_id max3355_match_table[] = {
@@ -129,7 +127,7 @@ MODULE_DEVICE_TABLE(of, max3355_match_table);

static struct platform_driver max3355_driver = {
.probe = max3355_probe,
- .remove = max3355_remove,
+ .remove_new = max3355_remove,
.driver = {
.name = "extcon-max3355",
.of_match_table = max3355_match_table,
--
2.43.0