Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: max3355: 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 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.

Link: https://lore.kernel.org/lkml/2c017ea490f721646bd472e7d427eb377e4e8423.1708876186.git.u.kleine-koenig@pengutronix.de/
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Uwe Kleine-König and committed by
Chanwoo Choi
ba6985ea 6d472f20

+2 -4
+2 -4
drivers/extcon/extcon-max3355.c
··· 112 112 return 0; 113 113 } 114 114 115 - static int max3355_remove(struct platform_device *pdev) 115 + static void max3355_remove(struct platform_device *pdev) 116 116 { 117 117 struct max3355_data *data = platform_get_drvdata(pdev); 118 118 119 119 gpiod_set_value_cansleep(data->shdn_gpiod, 0); 120 - 121 - return 0; 122 120 } 123 121 124 122 static const struct of_device_id max3355_match_table[] = { ··· 127 129 128 130 static struct platform_driver max3355_driver = { 129 131 .probe = max3355_probe, 130 - .remove = max3355_remove, 132 + .remove_new = max3355_remove, 131 133 .driver = { 132 134 .name = "extcon-max3355", 133 135 .of_match_table = max3355_match_table,