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

serial: rda: 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-33-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
b9fd3145 dd4d4497

+2 -4
+2 -4
drivers/tty/serial/rda-uart.c
··· 780 780 return ret; 781 781 } 782 782 783 - static int rda_uart_remove(struct platform_device *pdev) 783 + static void rda_uart_remove(struct platform_device *pdev) 784 784 { 785 785 struct rda_uart_port *rda_port = platform_get_drvdata(pdev); 786 786 787 787 uart_remove_one_port(&rda_uart_driver, &rda_port->port); 788 788 rda_uart_ports[pdev->id] = NULL; 789 - 790 - return 0; 791 789 } 792 790 793 791 static struct platform_driver rda_uart_platform_driver = { 794 792 .probe = rda_uart_probe, 795 - .remove = rda_uart_remove, 793 + .remove_new = rda_uart_remove, 796 794 .driver = { 797 795 .name = "rda-uart", 798 796 .of_match_table = rda_uart_dt_matches,