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

iio: proximity: srf04: 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>
Link: https://lore.kernel.org/r/20230919174931.1417681-47-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
4abfc97d 2df694f7

+2 -4
+2 -4
drivers/iio/proximity/srf04.c
··· 344 344 return ret; 345 345 } 346 346 347 - static int srf04_remove(struct platform_device *pdev) 347 + static void srf04_remove(struct platform_device *pdev) 348 348 { 349 349 struct iio_dev *indio_dev = platform_get_drvdata(pdev); 350 350 struct srf04_data *data = iio_priv(indio_dev); ··· 355 355 pm_runtime_disable(data->dev); 356 356 pm_runtime_set_suspended(data->dev); 357 357 } 358 - 359 - return 0; 360 358 } 361 359 362 360 static int srf04_pm_runtime_suspend(struct device *dev) ··· 389 391 390 392 static struct platform_driver srf04_driver = { 391 393 .probe = srf04_probe, 392 - .remove = srf04_remove, 394 + .remove_new = srf04_remove, 393 395 .driver = { 394 396 .name = "srf04-gpio", 395 397 .of_match_table = of_srf04_match,