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

iio: proximity: cros_ec_mkbp: 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20230919174931.1417681-46-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
2df694f7 23c81c10

+2 -4
+2 -4
drivers/iio/proximity/cros_ec_mkbp_proximity.c
··· 239 239 return 0; 240 240 } 241 241 242 - static int cros_ec_mkbp_proximity_remove(struct platform_device *pdev) 242 + static void cros_ec_mkbp_proximity_remove(struct platform_device *pdev) 243 243 { 244 244 struct cros_ec_mkbp_proximity_data *data = platform_get_drvdata(pdev); 245 245 struct cros_ec_device *ec = data->ec; 246 246 247 247 blocking_notifier_chain_unregister(&ec->event_notifier, 248 248 &data->notifier); 249 - 250 - return 0; 251 249 } 252 250 253 251 static const struct of_device_id cros_ec_mkbp_proximity_of_match[] = { ··· 261 263 .pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops), 262 264 }, 263 265 .probe = cros_ec_mkbp_proximity_probe, 264 - .remove = cros_ec_mkbp_proximity_remove, 266 + .remove_new = cros_ec_mkbp_proximity_remove, 265 267 }; 266 268 module_platform_driver(cros_ec_mkbp_proximity_driver); 267 269