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

bus: omap_l3_smx: 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.

Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20231109202830.4124591-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+2 -4
+2 -4
drivers/bus/omap_l3_smx.c
··· 261 261 return ret; 262 262 } 263 263 264 - static int omap3_l3_remove(struct platform_device *pdev) 264 + static void omap3_l3_remove(struct platform_device *pdev) 265 265 { 266 266 struct omap3_l3 *l3 = platform_get_drvdata(pdev); 267 267 ··· 269 269 free_irq(l3->debug_irq, l3); 270 270 iounmap(l3->rt); 271 271 kfree(l3); 272 - 273 - return 0; 274 272 } 275 273 276 274 static struct platform_driver omap3_l3_driver = { 277 275 .probe = omap3_l3_probe, 278 - .remove = omap3_l3_remove, 276 + .remove_new = omap3_l3_remove, 279 277 .driver = { 280 278 .name = "omap_l3_smx", 281 279 .of_match_table = of_match_ptr(omap3_l3_match),