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

can: mscan: mpc5xxx_can: 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() is
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/20230512212725.143824-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Uwe Kleine-König and committed by
Marc Kleine-Budde
36157299 2d7c33d0

+2 -4
+2 -4
drivers/net/can/mscan/mpc5xxx_can.c
··· 349 349 return err; 350 350 } 351 351 352 - static int mpc5xxx_can_remove(struct platform_device *ofdev) 352 + static void mpc5xxx_can_remove(struct platform_device *ofdev) 353 353 { 354 354 const struct of_device_id *match; 355 355 const struct mpc5xxx_can_data *data; ··· 365 365 iounmap(priv->reg_base); 366 366 irq_dispose_mapping(dev->irq); 367 367 free_candev(dev); 368 - 369 - return 0; 370 368 } 371 369 372 370 #ifdef CONFIG_PM ··· 435 437 .of_match_table = mpc5xxx_can_table, 436 438 }, 437 439 .probe = mpc5xxx_can_probe, 438 - .remove = mpc5xxx_can_remove, 440 + .remove_new = mpc5xxx_can_remove, 439 441 #ifdef CONFIG_PM 440 442 .suspend = mpc5xxx_can_suspend, 441 443 .resume = mpc5xxx_can_resume,