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: stm32-timers: 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-16-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

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

+2 -4
+2 -4
drivers/mfd/stm32-timers.c
··· 306 306 return ret; 307 307 } 308 308 309 - static int stm32_timers_remove(struct platform_device *pdev) 309 + static void stm32_timers_remove(struct platform_device *pdev) 310 310 { 311 311 struct stm32_timers *ddata = platform_get_drvdata(pdev); 312 312 ··· 316 316 */ 317 317 of_platform_depopulate(&pdev->dev); 318 318 stm32_timers_dma_remove(&pdev->dev, ddata); 319 - 320 - return 0; 321 319 } 322 320 323 321 static const struct of_device_id stm32_timers_of_match[] = { ··· 326 328 327 329 static struct platform_driver stm32_timers_driver = { 328 330 .probe = stm32_timers_probe, 329 - .remove = stm32_timers_remove, 331 + .remove_new = stm32_timers_remove, 330 332 .driver = { 331 333 .name = "stm32-timers", 332 334 .of_match_table = stm32_timers_of_match,