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

serial: sa1100: 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-34-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
1158e40b b9fd3145

+2 -4
+2 -4
drivers/tty/serial/sa1100.c
··· 870 870 return 0; 871 871 } 872 872 873 - static int sa1100_serial_remove(struct platform_device *pdev) 873 + static void sa1100_serial_remove(struct platform_device *pdev) 874 874 { 875 875 struct sa1100_port *sport = platform_get_drvdata(pdev); 876 876 877 877 if (sport) 878 878 uart_remove_one_port(&sa1100_reg, &sport->port); 879 - 880 - return 0; 881 879 } 882 880 883 881 static struct platform_driver sa11x0_serial_driver = { 884 882 .probe = sa1100_serial_probe, 885 - .remove = sa1100_serial_remove, 883 + .remove_new = sa1100_serial_remove, 886 884 .suspend = sa1100_serial_suspend, 887 885 .resume = sa1100_serial_resume, 888 886 .driver = {