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

serial: mpc52xx: 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-26-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
4cf1dabe abf11a4b

+2 -5
+2 -5
drivers/tty/serial/mpc52xx_uart.c
··· 1765 1765 return 0; 1766 1766 } 1767 1767 1768 - static int 1769 - mpc52xx_uart_of_remove(struct platform_device *op) 1768 + static void mpc52xx_uart_of_remove(struct platform_device *op) 1770 1769 { 1771 1770 struct uart_port *port = platform_get_drvdata(op); 1772 1771 1773 1772 if (port) 1774 1773 uart_remove_one_port(&mpc52xx_uart_driver, port); 1775 - 1776 - return 0; 1777 1774 } 1778 1775 1779 1776 #ifdef CONFIG_PM ··· 1843 1846 1844 1847 static struct platform_driver mpc52xx_uart_of_driver = { 1845 1848 .probe = mpc52xx_uart_of_probe, 1846 - .remove = mpc52xx_uart_of_remove, 1849 + .remove_new = mpc52xx_uart_of_remove, 1847 1850 #ifdef CONFIG_PM 1848 1851 .suspend = mpc52xx_uart_of_suspend, 1849 1852 .resume = mpc52xx_uart_of_resume,