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

serial: qcom_geni: 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-32-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
dd4d4497 915fd7f3

+2 -4
+2 -4
drivers/tty/serial/qcom_geni_serial.c
··· 1696 1696 return 0; 1697 1697 } 1698 1698 1699 - static int qcom_geni_serial_remove(struct platform_device *pdev) 1699 + static void qcom_geni_serial_remove(struct platform_device *pdev) 1700 1700 { 1701 1701 struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); 1702 1702 struct uart_driver *drv = port->private_data.drv; ··· 1704 1704 dev_pm_clear_wake_irq(&pdev->dev); 1705 1705 device_init_wakeup(&pdev->dev, false); 1706 1706 uart_remove_one_port(drv, &port->uport); 1707 - 1708 - return 0; 1709 1707 } 1710 1708 1711 1709 static int qcom_geni_serial_sys_suspend(struct device *dev) ··· 1803 1805 MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table); 1804 1806 1805 1807 static struct platform_driver qcom_geni_serial_platform_driver = { 1806 - .remove = qcom_geni_serial_remove, 1808 + .remove_new = qcom_geni_serial_remove, 1807 1809 .probe = qcom_geni_serial_probe, 1808 1810 .driver = { 1809 1811 .name = "qcom_geni_serial",