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

serial: lantiq: 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/20231110152927.70601-19-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
04300219 c066f873

+2 -4
+2 -4
drivers/tty/serial/lantiq.c
··· 887 887 return ret; 888 888 } 889 889 890 - static int lqasc_remove(struct platform_device *pdev) 890 + static void lqasc_remove(struct platform_device *pdev) 891 891 { 892 892 struct uart_port *port = platform_get_drvdata(pdev); 893 893 894 894 uart_remove_one_port(&lqasc_reg, port); 895 - 896 - return 0; 897 895 } 898 896 899 897 static const struct ltq_soc_data soc_data_lantiq = { ··· 915 917 916 918 static struct platform_driver lqasc_driver = { 917 919 .probe = lqasc_probe, 918 - .remove = lqasc_remove, 920 + .remove_new = lqasc_remove, 919 921 .driver = { 920 922 .name = DRVNAME, 921 923 .of_match_table = ltq_asc_match,