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

Configure Feed

Select the types of activity you want to include in your feed.

mfd: ti_am335x_tscadc: 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/20231123165627.492259-17-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Uwe Kleine-König and committed by
Lee Jones
740ad6d1 eea669cb

+2 -4
+2 -4
drivers/mfd/ti_am335x_tscadc.c
··· 298 298 return err; 299 299 } 300 300 301 - static int ti_tscadc_remove(struct platform_device *pdev) 301 + static void ti_tscadc_remove(struct platform_device *pdev) 302 302 { 303 303 struct ti_tscadc_dev *tscadc = platform_get_drvdata(pdev); 304 304 ··· 308 308 pm_runtime_disable(&pdev->dev); 309 309 310 310 mfd_remove_devices(tscadc->dev); 311 - 312 - return 0; 313 311 } 314 312 315 313 static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data) ··· 379 381 .of_match_table = ti_tscadc_dt_ids, 380 382 }, 381 383 .probe = ti_tscadc_probe, 382 - .remove = ti_tscadc_remove, 384 + .remove_new = ti_tscadc_remove, 383 385 384 386 }; 385 387