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

can: softing: 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-17-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
737aec8a bc79adfb

+2 -3
+2 -3
drivers/net/can/softing/softing_main.c
··· 729 729 /* 730 730 * platform driver 731 731 */ 732 - static int softing_pdev_remove(struct platform_device *pdev) 732 + static void softing_pdev_remove(struct platform_device *pdev) 733 733 { 734 734 struct softing *card = platform_get_drvdata(pdev); 735 735 int j; ··· 747 747 748 748 iounmap(card->dpram); 749 749 kfree(card); 750 - return 0; 751 750 } 752 751 753 752 static int softing_pdev_probe(struct platform_device *pdev) ··· 854 855 .name = KBUILD_MODNAME, 855 856 }, 856 857 .probe = softing_pdev_probe, 857 - .remove = softing_pdev_remove, 858 + .remove_new = softing_pdev_remove, 858 859 }; 859 860 860 861 module_platform_driver(softing_driver);