linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 17:49   ` Florian Fainelli
                     ` (3 more replies)
  2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  15 siblings, 4 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Joel Stanley, Andrew Jeffery, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Al Cooper, Ilpo Järvinen, Andy Shevchenko, Paul Cercueil,
	Vladimir Zapolskiy, Matthias Brugger, AngeloGioacchino Del Regno,
	Thierry Reding, Jonathan Hunter, Kunihiko Hayashi,
	Masami Hiramatsu, John Ogness, Thomas Gleixner, Tony Lindgren,
	Petr Mladek, Biju Das, Johan Hovold, Chen-Yu Tsai, Andi Shyti,
	Thomas Richard, Rob Herring, Geert Uytterhoeven, Arnd Bergmann,
	Duje Mihanović, Rafael J. Wysocki, Jacob Keller,
	Christophe JAILLET, kernel, linux-serial, linux-arm-kernel,
	linux-aspeed, linux-rpi-kernel, linux-mips, linux-mediatek,
	linux-tegra

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>
---
 drivers/tty/serial/8250/8250_aspeed_vuart.c | 6 ++----
 drivers/tty/serial/8250/8250_bcm2835aux.c   | 6 ++----
 drivers/tty/serial/8250/8250_bcm7271.c      | 5 ++---
 drivers/tty/serial/8250/8250_core.c         | 5 ++---
 drivers/tty/serial/8250/8250_dw.c           | 6 ++----
 drivers/tty/serial/8250/8250_em.c           | 5 ++---
 drivers/tty/serial/8250/8250_fsl.c          | 5 ++---
 drivers/tty/serial/8250/8250_ingenic.c      | 5 ++---
 drivers/tty/serial/8250/8250_ioc3.c         | 5 ++---
 drivers/tty/serial/8250/8250_lpc18xx.c      | 6 ++----
 drivers/tty/serial/8250/8250_mtk.c          | 6 ++----
 drivers/tty/serial/8250/8250_of.c           | 5 ++---
 drivers/tty/serial/8250/8250_omap.c         | 5 ++---
 drivers/tty/serial/8250/8250_pxa.c          | 6 ++----
 drivers/tty/serial/8250/8250_tegra.c        | 6 ++----
 drivers/tty/serial/8250/8250_uniphier.c     | 6 ++----
 16 files changed, 32 insertions(+), 56 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
index d7482ae33a1c..8c2aaf7af7b7 100644
--- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
@@ -566,7 +566,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int aspeed_vuart_remove(struct platform_device *pdev)
+static void aspeed_vuart_remove(struct platform_device *pdev)
 {
 	struct aspeed_vuart *vuart = platform_get_drvdata(pdev);
 
@@ -574,8 +574,6 @@ static int aspeed_vuart_remove(struct platform_device *pdev)
 	aspeed_vuart_set_enabled(vuart, false);
 	serial8250_unregister_port(vuart->line);
 	sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
-
-	return 0;
 }
 
 static const struct of_device_id aspeed_vuart_table[] = {
@@ -590,7 +588,7 @@ static struct platform_driver aspeed_vuart_driver = {
 		.of_match_table = aspeed_vuart_table,
 	},
 	.probe = aspeed_vuart_probe,
-	.remove = aspeed_vuart_remove,
+	.remove_new = aspeed_vuart_remove,
 };
 
 module_platform_driver(aspeed_vuart_driver);
diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
index 15a2387a5b25..b5760f914a8c 100644
--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
+++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
@@ -195,14 +195,12 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int bcm2835aux_serial_remove(struct platform_device *pdev)
+static void bcm2835aux_serial_remove(struct platform_device *pdev)
 {
 	struct bcm2835aux_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
 	clk_disable_unprepare(data->clk);
-
-	return 0;
 }
 
 static const struct bcm2835_aux_serial_driver_data bcm2835_acpi_data = {
@@ -228,7 +226,7 @@ static struct platform_driver bcm2835aux_serial_driver = {
 		.acpi_match_table = bcm2835aux_serial_acpi_match,
 	},
 	.probe  = bcm2835aux_serial_probe,
-	.remove = bcm2835aux_serial_remove,
+	.remove_new = bcm2835aux_serial_remove,
 };
 module_platform_driver(bcm2835aux_serial_driver);
 
diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index 55dea2539c47..504c4c020857 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -1121,7 +1121,7 @@ static int brcmuart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int brcmuart_remove(struct platform_device *pdev)
+static void brcmuart_remove(struct platform_device *pdev)
 {
 	struct brcmuart_priv *priv = platform_get_drvdata(pdev);
 
@@ -1131,7 +1131,6 @@ static int brcmuart_remove(struct platform_device *pdev)
 	brcmuart_free_bufs(&pdev->dev, priv);
 	if (priv->dma_enabled)
 		brcmuart_arbitration(priv, 0);
-	return 0;
 }
 
 static int __maybe_unused brcmuart_suspend(struct device *dev)
@@ -1207,7 +1206,7 @@ static struct platform_driver brcmuart_platform_driver = {
 		.of_match_table = brcmuart_dt_ids,
 	},
 	.probe		= brcmuart_probe,
-	.remove		= brcmuart_remove,
+	.remove_new	= brcmuart_remove,
 };
 
 static int __init brcmuart_init(void)
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 912733151858..b62ad9006780 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -883,7 +883,7 @@ static int serial8250_probe(struct platform_device *dev)
 /*
  * Remove serial ports registered against a platform device.
  */
-static int serial8250_remove(struct platform_device *dev)
+static void serial8250_remove(struct platform_device *dev)
 {
 	int i;
 
@@ -893,7 +893,6 @@ static int serial8250_remove(struct platform_device *dev)
 		if (up->port.dev == &dev->dev)
 			serial8250_unregister_port(i);
 	}
-	return 0;
 }
 
 static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
@@ -926,7 +925,7 @@ static int serial8250_resume(struct platform_device *dev)
 
 static struct platform_driver serial8250_isa_driver = {
 	.probe		= serial8250_probe,
-	.remove		= serial8250_remove,
+	.remove_new	= serial8250_remove,
 	.suspend	= serial8250_suspend,
 	.resume		= serial8250_resume,
 	.driver		= {
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index b94f567647cb..63b14ce9c009 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -663,7 +663,7 @@ static int dw8250_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int dw8250_remove(struct platform_device *pdev)
+static void dw8250_remove(struct platform_device *pdev)
 {
 	struct dw8250_data *data = platform_get_drvdata(pdev);
 	struct device *dev = &pdev->dev;
@@ -680,8 +680,6 @@ static int dw8250_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(dev);
 	pm_runtime_put_noidle(dev);
-
-	return 0;
 }
 
 static int dw8250_suspend(struct device *dev)
@@ -789,7 +787,7 @@ static struct platform_driver dw8250_platform_driver = {
 		.acpi_match_table = dw8250_acpi_match,
 	},
 	.probe			= dw8250_probe,
-	.remove			= dw8250_remove,
+	.remove_new		= dw8250_remove,
 };
 
 module_platform_driver(dw8250_platform_driver);
diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index ef5019e944ea..a754755100ff 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -200,12 +200,11 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int serial8250_em_remove(struct platform_device *pdev)
+static void serial8250_em_remove(struct platform_device *pdev)
 {
 	struct serial8250_em_priv *priv = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(priv->line);
-	return 0;
 }
 
 static const struct of_device_id serial8250_em_dt_ids[] = {
@@ -220,7 +219,7 @@ static struct platform_driver serial8250_em_platform_driver = {
 		.of_match_table = serial8250_em_dt_ids,
 	},
 	.probe			= serial8250_em_probe,
-	.remove			= serial8250_em_remove,
+	.remove_new		= serial8250_em_remove,
 };
 
 module_platform_driver(serial8250_em_platform_driver);
diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8250_fsl.c
index f522eb5026c9..5cf675eadefe 100644
--- a/drivers/tty/serial/8250/8250_fsl.c
+++ b/drivers/tty/serial/8250/8250_fsl.c
@@ -159,12 +159,11 @@ static int fsl8250_acpi_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int fsl8250_acpi_remove(struct platform_device *pdev)
+static void fsl8250_acpi_remove(struct platform_device *pdev)
 {
 	struct fsl8250_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
-	return 0;
 }
 
 static const struct acpi_device_id fsl_8250_acpi_id[] = {
@@ -179,7 +178,7 @@ static struct platform_driver fsl8250_platform_driver = {
 		.acpi_match_table	= ACPI_PTR(fsl_8250_acpi_id),
 	},
 	.probe			= fsl8250_acpi_probe,
-	.remove			= fsl8250_acpi_remove,
+	.remove_new		= fsl8250_acpi_remove,
 };
 
 module_platform_driver(fsl8250_platform_driver);
diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index 4c4c4da73ad0..a12f737924c0 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -320,14 +320,13 @@ static int ingenic_uart_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ingenic_uart_remove(struct platform_device *pdev)
+static void ingenic_uart_remove(struct platform_device *pdev)
 {
 	struct ingenic_uart_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
 	clk_disable_unprepare(data->clk_module);
 	clk_disable_unprepare(data->clk_baud);
-	return 0;
 }
 
 static const struct ingenic_uart_config jz4740_uart_config = {
@@ -368,7 +367,7 @@ static struct platform_driver ingenic_uart_platform_driver = {
 		.of_match_table	= of_match,
 	},
 	.probe			= ingenic_uart_probe,
-	.remove			= ingenic_uart_remove,
+	.remove_new		= ingenic_uart_remove,
 };
 
 module_platform_driver(ingenic_uart_platform_driver);
diff --git a/drivers/tty/serial/8250/8250_ioc3.c b/drivers/tty/serial/8250/8250_ioc3.c
index d5a39e105a76..50c77c3dacf2 100644
--- a/drivers/tty/serial/8250/8250_ioc3.c
+++ b/drivers/tty/serial/8250/8250_ioc3.c
@@ -75,17 +75,16 @@ static int serial8250_ioc3_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int serial8250_ioc3_remove(struct platform_device *pdev)
+static void serial8250_ioc3_remove(struct platform_device *pdev)
 {
 	struct ioc3_8250_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
-	return 0;
 }
 
 static struct platform_driver serial8250_ioc3_driver = {
 	.probe  = serial8250_ioc3_probe,
-	.remove = serial8250_ioc3_remove,
+	.remove_new = serial8250_ioc3_remove,
 	.driver = {
 		.name = "ioc3-serial8250",
 	}
diff --git a/drivers/tty/serial/8250/8250_lpc18xx.c b/drivers/tty/serial/8250/8250_lpc18xx.c
index 6dc85aaba5d0..8d728a6a5991 100644
--- a/drivers/tty/serial/8250/8250_lpc18xx.c
+++ b/drivers/tty/serial/8250/8250_lpc18xx.c
@@ -182,15 +182,13 @@ static int lpc18xx_serial_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int lpc18xx_serial_remove(struct platform_device *pdev)
+static void lpc18xx_serial_remove(struct platform_device *pdev)
 {
 	struct lpc18xx_uart_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
 	clk_disable_unprepare(data->clk_uart);
 	clk_disable_unprepare(data->clk_reg);
-
-	return 0;
 }
 
 static const struct of_device_id lpc18xx_serial_match[] = {
@@ -201,7 +199,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_serial_match);
 
 static struct platform_driver lpc18xx_serial_driver = {
 	.probe  = lpc18xx_serial_probe,
-	.remove = lpc18xx_serial_remove,
+	.remove_new = lpc18xx_serial_remove,
 	.driver = {
 		.name = "lpc18xx-uart",
 		.of_match_table = lpc18xx_serial_match,
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 23457daae8a1..9ff6bbe9c086 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -581,7 +581,7 @@ static int mtk8250_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int mtk8250_remove(struct platform_device *pdev)
+static void mtk8250_remove(struct platform_device *pdev)
 {
 	struct mtk8250_data *data = platform_get_drvdata(pdev);
 
@@ -591,8 +591,6 @@ static int mtk8250_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_put_noidle(&pdev->dev);
-
-	return 0;
 }
 
 static int __maybe_unused mtk8250_suspend(struct device *dev)
@@ -652,7 +650,7 @@ static struct platform_driver mtk8250_platform_driver = {
 		.of_match_table	= mtk8250_of_match,
 	},
 	.probe			= mtk8250_probe,
-	.remove			= mtk8250_remove,
+	.remove_new		= mtk8250_remove,
 };
 module_platform_driver(mtk8250_platform_driver);
 
diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
index ef3e745bd09c..34f17a9785e7 100644
--- a/drivers/tty/serial/8250/8250_of.c
+++ b/drivers/tty/serial/8250/8250_of.c
@@ -251,7 +251,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
 /*
  * Release a line
  */
-static int of_platform_serial_remove(struct platform_device *ofdev)
+static void of_platform_serial_remove(struct platform_device *ofdev)
 {
 	struct of_serial_info *info = platform_get_drvdata(ofdev);
 
@@ -261,7 +261,6 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
 	pm_runtime_put_sync(&ofdev->dev);
 	pm_runtime_disable(&ofdev->dev);
 	kfree(info);
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -337,7 +336,7 @@ static struct platform_driver of_platform_serial_driver = {
 		.pm = &of_serial_pm_ops,
 	},
 	.probe = of_platform_serial_probe,
-	.remove = of_platform_serial_remove,
+	.remove_new = of_platform_serial_remove,
 };
 
 module_platform_driver(of_platform_serial_driver);
diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 661a83dbc11b..5a89a8cd7f71 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1584,7 +1584,7 @@ static int omap8250_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int omap8250_remove(struct platform_device *pdev)
+static void omap8250_remove(struct platform_device *pdev)
 {
 	struct omap8250_priv *priv = platform_get_drvdata(pdev);
 	struct uart_8250_port *up;
@@ -1604,7 +1604,6 @@ static int omap8250_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	cpu_latency_qos_remove_request(&priv->pm_qos_request);
 	device_init_wakeup(&pdev->dev, false);
-	return 0;
 }
 
 static int omap8250_prepare(struct device *dev)
@@ -1863,7 +1862,7 @@ static struct platform_driver omap8250_platform_driver = {
 		.of_match_table = omap8250_dt_ids,
 	},
 	.probe			= omap8250_probe,
-	.remove			= omap8250_remove,
+	.remove_new		= omap8250_remove,
 };
 module_platform_driver(omap8250_platform_driver);
 
diff --git a/drivers/tty/serial/8250/8250_pxa.c b/drivers/tty/serial/8250/8250_pxa.c
index a5b3ea27fc90..77686da42ce8 100644
--- a/drivers/tty/serial/8250/8250_pxa.c
+++ b/drivers/tty/serial/8250/8250_pxa.c
@@ -146,20 +146,18 @@ static int serial_pxa_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int serial_pxa_remove(struct platform_device *pdev)
+static void serial_pxa_remove(struct platform_device *pdev)
 {
 	struct pxa8250_data *data = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(data->line);
 
 	clk_unprepare(data->clk);
-
-	return 0;
 }
 
 static struct platform_driver serial_pxa_driver = {
 	.probe          = serial_pxa_probe,
-	.remove         = serial_pxa_remove,
+	.remove_new     = serial_pxa_remove,
 
 	.driver		= {
 		.name	= "pxa2xx-uart",
diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c
index 89956bbf34d9..ba352262df75 100644
--- a/drivers/tty/serial/8250/8250_tegra.c
+++ b/drivers/tty/serial/8250/8250_tegra.c
@@ -128,15 +128,13 @@ static int tegra_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int tegra_uart_remove(struct platform_device *pdev)
+static void tegra_uart_remove(struct platform_device *pdev)
 {
 	struct tegra_uart *uart = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(uart->line);
 	reset_control_assert(uart->rst);
 	clk_disable_unprepare(uart->clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -192,7 +190,7 @@ static struct platform_driver tegra_uart_driver = {
 		.acpi_match_table = ACPI_PTR(tegra_uart_acpi_match),
 	},
 	.probe = tegra_uart_probe,
-	.remove = tegra_uart_remove,
+	.remove_new = tegra_uart_remove,
 };
 
 module_platform_driver(tegra_uart_driver);
diff --git a/drivers/tty/serial/8250/8250_uniphier.c b/drivers/tty/serial/8250/8250_uniphier.c
index a405155264b1..6399a38ecce2 100644
--- a/drivers/tty/serial/8250/8250_uniphier.c
+++ b/drivers/tty/serial/8250/8250_uniphier.c
@@ -241,14 +241,12 @@ static int uniphier_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int uniphier_uart_remove(struct platform_device *pdev)
+static void uniphier_uart_remove(struct platform_device *pdev)
 {
 	struct uniphier8250_priv *priv = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(priv->line);
 	clk_disable_unprepare(priv->clk);
-
-	return 0;
 }
 
 static int __maybe_unused uniphier_uart_suspend(struct device *dev)
@@ -293,7 +291,7 @@ MODULE_DEVICE_TABLE(of, uniphier_uart_match);
 
 static struct platform_driver uniphier_uart_platform_driver = {
 	.probe		= uniphier_uart_probe,
-	.remove		= uniphier_uart_remove,
+	.remove_new	= uniphier_uart_remove,
 	.driver = {
 		.name	= "uniphier-uart",
 		.of_match_table = uniphier_uart_match,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 08/52] serial: atmel: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 18:09   ` claudiu beznea
  2023-11-13 16:22   ` Richard Genoud
  2023-11-10 15:29 ` [PATCH 10/52] serial: clps711x: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  15 siblings, 2 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Alexandre Belloni, kernel, Richard Genoud, Claudiu Beznea,
	linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/atmel_serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 1946fafc3f3e..6792680690bd 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -3001,7 +3001,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
  * protocol that needs bitbanging on IO lines, but use the regular serial
  * port in the normal case.
  */
-static int atmel_serial_remove(struct platform_device *pdev)
+static void atmel_serial_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
@@ -3020,8 +3020,6 @@ static int atmel_serial_remove(struct platform_device *pdev)
 	clear_bit(port->line, atmel_ports_in_use);
 
 	pdev->dev.of_node = NULL;
-
-	return 0;
 }
 
 static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
@@ -3029,7 +3027,7 @@ static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
 
 static struct platform_driver atmel_serial_driver = {
 	.probe		= atmel_serial_probe,
-	.remove		= atmel_serial_remove,
+	.remove_new	= atmel_serial_remove,
 	.driver		= {
 		.name			= "atmel_usart_serial",
 		.of_match_table		= of_match_ptr(atmel_serial_dt_ids),
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 10/52] serial: clps711x: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 12/52] serial: digicolor: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Alexander Shiyan, Maciej W. Rozycki, Yangtao Li, kernel,
	linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/clps711x.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index 55d19937efbd..7927725b8957 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -510,13 +510,11 @@ static int uart_clps711x_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int uart_clps711x_remove(struct platform_device *pdev)
+static void uart_clps711x_remove(struct platform_device *pdev)
 {
 	struct clps711x_port *s = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&clps711x_uart, &s->port);
-
-	return 0;
 }
 
 static const struct of_device_id __maybe_unused clps711x_uart_dt_ids[] = {
@@ -531,7 +529,7 @@ static struct platform_driver clps711x_uart_platform = {
 		.of_match_table	= of_match_ptr(clps711x_uart_dt_ids),
 	},
 	.probe	= uart_clps711x_probe,
-	.remove	= uart_clps711x_remove,
+	.remove_new = uart_clps711x_remove,
 };
 
 static int __init uart_clps711x_init(void)
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 12/52] serial: digicolor: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (2 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 10/52] serial: clps711x: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 17/52] serial: imx: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Baruch Siach, Thierry Reding, Tobias Klauser, Thomas Gleixner,
	kernel, linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/digicolor-usart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/digicolor-usart.c b/drivers/tty/serial/digicolor-usart.c
index 5004125f3045..e419c4bde8b7 100644
--- a/drivers/tty/serial/digicolor-usart.c
+++ b/drivers/tty/serial/digicolor-usart.c
@@ -503,13 +503,11 @@ static int digicolor_uart_probe(struct platform_device *pdev)
 	return uart_add_one_port(&digicolor_uart, &dp->port);
 }
 
-static int digicolor_uart_remove(struct platform_device *pdev)
+static void digicolor_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&digicolor_uart, port);
-
-	return 0;
 }
 
 static const struct of_device_id digicolor_uart_dt_ids[] = {
@@ -524,7 +522,7 @@ static struct platform_driver digicolor_uart_platform = {
 		.of_match_table	= of_match_ptr(digicolor_uart_dt_ids),
 	},
 	.probe	= digicolor_uart_probe,
-	.remove	= digicolor_uart_remove,
+	.remove_new = digicolor_uart_remove,
 };
 
 static int __init digicolor_uart_init(void)
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 17/52] serial: imx: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (3 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 12/52] serial: digicolor: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 20/52] serial: lpc32xx_hs: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Sergey Organov, Ilpo Järvinen, Rob Herring,
	Tom Rix, Thomas Gleixner, Martin Fuzzey, linux-serial,
	linux-arm-kernel

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>
---
 drivers/tty/serial/imx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 708b9852a575..3ea9466ee5ef 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2465,13 +2465,11 @@ static int imx_uart_probe(struct platform_device *pdev)
 	return uart_add_one_port(&imx_uart_uart_driver, &sport->port);
 }
 
-static int imx_uart_remove(struct platform_device *pdev)
+static void imx_uart_remove(struct platform_device *pdev)
 {
 	struct imx_port *sport = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&imx_uart_uart_driver, &sport->port);
-
-	return 0;
 }
 
 static void imx_uart_restore_context(struct imx_port *sport)
@@ -2640,7 +2638,7 @@ static const struct dev_pm_ops imx_uart_pm_ops = {
 
 static struct platform_driver imx_uart_platform_driver = {
 	.probe = imx_uart_probe,
-	.remove = imx_uart_remove,
+	.remove_new = imx_uart_remove,
 
 	.driver = {
 		.name = "imx-uart",
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 20/52] serial: lpc32xx_hs: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (4 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 17/52] serial: imx: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 21/52] serial: ma35d1: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Vladimir Zapolskiy, Thomas Gleixner, John Ogness, kernel,
	linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/lpc32xx_hs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c
index 5149a947b7fe..ec20329f0603 100644
--- a/drivers/tty/serial/lpc32xx_hs.c
+++ b/drivers/tty/serial/lpc32xx_hs.c
@@ -659,13 +659,11 @@ static int serial_hs_lpc32xx_probe(struct platform_device *pdev)
 /*
  * Remove serial ports registered against a platform device.
  */
-static int serial_hs_lpc32xx_remove(struct platform_device *pdev)
+static void serial_hs_lpc32xx_remove(struct platform_device *pdev)
 {
 	struct lpc32xx_hsuart_port *p = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&lpc32xx_hs_reg, &p->port);
-
-	return 0;
 }
 
 
@@ -702,7 +700,7 @@ MODULE_DEVICE_TABLE(of, serial_hs_lpc32xx_dt_ids);
 
 static struct platform_driver serial_hs_lpc32xx_driver = {
 	.probe		= serial_hs_lpc32xx_probe,
-	.remove		= serial_hs_lpc32xx_remove,
+	.remove_new	= serial_hs_lpc32xx_remove,
 	.suspend	= serial_hs_lpc32xx_suspend,
 	.resume		= serial_hs_lpc32xx_resume,
 	.driver		= {
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 21/52] serial: ma35d1: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (5 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 20/52] serial: lpc32xx_hs: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 23/52] serial: meson: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Jacky Huang, Shan-Chun Hung, linux-arm-kernel, kernel,
	linux-serial

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>
---
 drivers/tty/serial/ma35d1_serial.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
index a6a7c405892e..f9c6c75d9776 100644
--- a/drivers/tty/serial/ma35d1_serial.c
+++ b/drivers/tty/serial/ma35d1_serial.c
@@ -746,14 +746,13 @@ static int ma35d1serial_probe(struct platform_device *pdev)
 /*
  * Remove serial ports registered against a platform device.
  */
-static int ma35d1serial_remove(struct platform_device *dev)
+static void ma35d1serial_remove(struct platform_device *dev)
 {
 	struct uart_port *port = platform_get_drvdata(dev);
 	struct uart_ma35d1_port *up = to_ma35d1_uart_port(port);
 
 	uart_remove_one_port(&ma35d1serial_reg, port);
 	clk_disable_unprepare(up->clk);
-	return 0;
 }
 
 static int ma35d1serial_suspend(struct platform_device *dev, pm_message_t state)
@@ -786,7 +785,7 @@ static int ma35d1serial_resume(struct platform_device *dev)
 
 static struct platform_driver ma35d1serial_driver = {
 	.probe      = ma35d1serial_probe,
-	.remove     = ma35d1serial_remove,
+	.remove_new = ma35d1serial_remove,
 	.suspend    = ma35d1serial_suspend,
 	.resume     = ma35d1serial_resume,
 	.driver     = {
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 23/52] serial: meson: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (6 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 21/52] serial: ma35d1: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 24/52] serial: milbeaut_usio: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Dmitry Rokosov, Lucas Tanure, Thomas Gleixner, Pavel Krasavin,
	kernel, linux-serial, linux-arm-kernel, linux-amlogic

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>
---
 drivers/tty/serial/meson_uart.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c
index 8dd84617e715..8395688f5ee9 100644
--- a/drivers/tty/serial/meson_uart.c
+++ b/drivers/tty/serial/meson_uart.c
@@ -795,7 +795,7 @@ static int meson_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int meson_uart_remove(struct platform_device *pdev)
+static void meson_uart_remove(struct platform_device *pdev)
 {
 	struct uart_driver *uart_driver;
 	struct uart_port *port;
@@ -807,12 +807,10 @@ static int meson_uart_remove(struct platform_device *pdev)
 
 	for (int id = 0; id < AML_UART_PORT_NUM; id++)
 		if (meson_ports[id])
-			return 0;
+			return;
 
 	/* No more available uart ports, unregister uart driver */
 	uart_unregister_driver(uart_driver);
-
-	return 0;
 }
 
 static struct meson_uart_data meson_g12a_uart_data = {
@@ -852,7 +850,7 @@ MODULE_DEVICE_TABLE(of, meson_uart_dt_match);
 
 static  struct platform_driver meson_uart_platform_driver = {
 	.probe		= meson_uart_probe,
-	.remove		= meson_uart_remove,
+	.remove_new	= meson_uart_remove,
 	.driver		= {
 		.name		= "meson_uart",
 		.of_match_table	= meson_uart_dt_match,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 24/52] serial: milbeaut_usio: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (7 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 23/52] serial: meson: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 27/52] serial: mxs-auart: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Taichi Sugaya, Takao Orito, Richard GENOUD, Thierry Reding,
	Maciej W. Rozycki, Thomas Gleixner, kernel, linux-serial,
	linux-arm-kernel

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>
---
 drivers/tty/serial/milbeaut_usio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/milbeaut_usio.c b/drivers/tty/serial/milbeaut_usio.c
index db3b81f2aa57..da4c6f7e2a30 100644
--- a/drivers/tty/serial/milbeaut_usio.c
+++ b/drivers/tty/serial/milbeaut_usio.c
@@ -552,15 +552,13 @@ static int mlb_usio_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mlb_usio_remove(struct platform_device *pdev)
+static void mlb_usio_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = &mlb_usio_ports[pdev->id];
 	struct clk *clk = port->private_data;
 
 	uart_remove_one_port(&mlb_usio_uart_driver, port);
 	clk_disable_unprepare(clk);
-
-	return 0;
 }
 
 static const struct of_device_id mlb_usio_dt_ids[] = {
@@ -571,7 +569,7 @@ MODULE_DEVICE_TABLE(of, mlb_usio_dt_ids);
 
 static struct platform_driver mlb_usio_driver = {
 	.probe          = mlb_usio_probe,
-	.remove         = mlb_usio_remove,
+	.remove_new     = mlb_usio_remove,
 	.driver         = {
 		.name   = USIO_NAME,
 		.of_match_table = mlb_usio_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 27/52] serial: mxs-auart: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (8 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 24/52] serial: milbeaut_usio: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Rob Herring, Maciej W. Rozycki, Tobias Klauser,
	linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/mxs-auart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
index 8eeecf8ad359..2be9546e0e15 100644
--- a/drivers/tty/serial/mxs-auart.c
+++ b/drivers/tty/serial/mxs-auart.c
@@ -1686,7 +1686,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mxs_auart_remove(struct platform_device *pdev)
+static void mxs_auart_remove(struct platform_device *pdev)
 {
 	struct mxs_auart_port *s = platform_get_drvdata(pdev);
 
@@ -1698,13 +1698,11 @@ static int mxs_auart_remove(struct platform_device *pdev)
 		clk_disable_unprepare(s->clk);
 		clk_disable_unprepare(s->clk_ahb);
 	}
-
-	return 0;
 }
 
 static struct platform_driver mxs_auart_driver = {
 	.probe = mxs_auart_probe,
-	.remove = mxs_auart_remove,
+	.remove_new = mxs_auart_remove,
 	.driver = {
 		.name = "mxs-auart",
 		.of_match_table = mxs_auart_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 29/52] serial: owl: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (9 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 27/52] serial: mxs-auart: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 32/52] serial: rda: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andreas Färber, Manivannan Sadhasivam, Thomas Gleixner,
	John Ogness, kernel, linux-serial, linux-arm-kernel,
	linux-actions

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>
---
 drivers/tty/serial/owl-uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
index 919f5e5aa0f1..d9fe85397741 100644
--- a/drivers/tty/serial/owl-uart.c
+++ b/drivers/tty/serial/owl-uart.c
@@ -725,20 +725,18 @@ static int owl_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int owl_uart_remove(struct platform_device *pdev)
+static void owl_uart_remove(struct platform_device *pdev)
 {
 	struct owl_uart_port *owl_port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&owl_uart_driver, &owl_port->port);
 	owl_uart_ports[pdev->id] = NULL;
 	clk_disable_unprepare(owl_port->clk);
-
-	return 0;
 }
 
 static struct platform_driver owl_uart_platform_driver = {
 	.probe = owl_uart_probe,
-	.remove = owl_uart_remove,
+	.remove_new = owl_uart_remove,
 	.driver = {
 		.name = "owl-uart",
 		.of_match_table = owl_uart_dt_matches,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 32/52] serial: rda: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (10 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 34/52] serial: samsung: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Manivannan Sadhasivam, linux-arm-kernel, linux-unisoc, kernel,
	linux-serial

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>
---
 drivers/tty/serial/rda-uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/rda-uart.c b/drivers/tty/serial/rda-uart.c
index d824c8318f33..13deb355cf1b 100644
--- a/drivers/tty/serial/rda-uart.c
+++ b/drivers/tty/serial/rda-uart.c
@@ -780,19 +780,17 @@ static int rda_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rda_uart_remove(struct platform_device *pdev)
+static void rda_uart_remove(struct platform_device *pdev)
 {
 	struct rda_uart_port *rda_port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&rda_uart_driver, &rda_port->port);
 	rda_uart_ports[pdev->id] = NULL;
-
-	return 0;
 }
 
 static struct platform_driver rda_uart_platform_driver = {
 	.probe = rda_uart_probe,
-	.remove = rda_uart_remove,
+	.remove_new = rda_uart_remove,
 	.driver = {
 		.name = "rda-uart",
 		.of_match_table = rda_uart_dt_matches,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 34/52] serial: samsung: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (11 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 32/52] serial: rda: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-12  7:48   ` Krzysztof Kozlowski
  2023-11-10 15:30 ` [PATCH 41/52] serial: st-asc: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  15 siblings, 1 reply; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Krzysztof Kozlowski, Alim Akhtar, linux-arm-kernel,
	linux-samsung-soc, kernel, linux-serial

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>
---
 drivers/tty/serial/samsung_tty.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
index 3bd552841cd2..1b0c2b467a30 100644
--- a/drivers/tty/serial/samsung_tty.c
+++ b/drivers/tty/serial/samsung_tty.c
@@ -2054,7 +2054,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int s3c24xx_serial_remove(struct platform_device *dev)
+static void s3c24xx_serial_remove(struct platform_device *dev)
 {
 	struct uart_port *port = s3c24xx_dev_to_port(&dev->dev);
 
@@ -2063,8 +2063,6 @@ static int s3c24xx_serial_remove(struct platform_device *dev)
 	}
 
 	uart_unregister_driver(&s3c24xx_uart_drv);
-
-	return 0;
 }
 
 /* UART power management code */
@@ -2611,7 +2609,7 @@ MODULE_DEVICE_TABLE(of, s3c24xx_uart_dt_match);
 
 static struct platform_driver samsung_serial_driver = {
 	.probe		= s3c24xx_serial_probe,
-	.remove		= s3c24xx_serial_remove,
+	.remove_new	= s3c24xx_serial_remove,
 	.id_table	= s3c24xx_serial_driver_ids,
 	.driver		= {
 		.name	= "samsung-uart",
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 41/52] serial: st-asc: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (12 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 34/52] serial: samsung: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 42/52] serial: stm32: " Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 52/52] serial: xilinx_uartps: " Uwe Kleine-König
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Patrice Chotard, linux-arm-kernel, kernel, linux-serial

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>
---
 drivers/tty/serial/st-asc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index a821f5d76a26..bbb5595d7e24 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -793,13 +793,11 @@ static int asc_serial_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int asc_serial_remove(struct platform_device *pdev)
+static void asc_serial_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&asc_uart_driver, port);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -932,7 +930,7 @@ static const struct dev_pm_ops asc_serial_pm_ops = {
 
 static struct platform_driver asc_serial_driver = {
 	.probe		= asc_serial_probe,
-	.remove		= asc_serial_remove,
+	.remove_new	= asc_serial_remove,
 	.driver	= {
 		.name	= DRIVER_NAME,
 		.pm	= &asc_serial_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 42/52] serial: stm32: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (13 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 41/52] serial: st-asc: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 52/52] serial: xilinx_uartps: " Uwe Kleine-König
  15 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Maxime Coquelin, Alexandre Torgue, Valentin Caron, Marek Vasut,
	Sebastian Andrzej Siewior, Thomas Gleixner, Erwan Le Ray, kernel,
	linux-serial, linux-stm32, linux-arm-kernel

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>
---
 drivers/tty/serial/stm32-usart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index 3048620315d6..9781c143def2 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -1822,7 +1822,7 @@ static int stm32_usart_serial_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int stm32_usart_serial_remove(struct platform_device *pdev)
+static void stm32_usart_serial_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 	struct stm32_port *stm32_port = to_stm32_port(port);
@@ -1861,8 +1861,6 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)
 	}
 
 	stm32_usart_deinit_port(stm32_port);
-
-	return 0;
 }
 
 static void __maybe_unused stm32_usart_console_putchar(struct uart_port *port, unsigned char ch)
@@ -2146,7 +2144,7 @@ static const struct dev_pm_ops stm32_serial_pm_ops = {
 
 static struct platform_driver stm32_serial_driver = {
 	.probe		= stm32_usart_serial_probe,
-	.remove		= stm32_usart_serial_remove,
+	.remove_new	= stm32_usart_serial_remove,
 	.driver	= {
 		.name	= DRIVER_NAME,
 		.pm	= &stm32_serial_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 52/52] serial: xilinx_uartps: Convert to platform remove callback returning void
       [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
                   ` (14 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 42/52] serial: stm32: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-13  9:41   ` Michal Simek
  15 siblings, 1 reply; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Michal Simek, Petr Mladek, John Ogness, Ruan Jinjie, Julien Malik,
	Thomas Gleixner, kernel, linux-serial, linux-arm-kernel

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>
---
 drivers/tty/serial/xilinx_uartps.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 66a45a634158..6decf2b13340 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1666,7 +1666,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
  *
  * Return: 0 on success, negative errno otherwise
  */
-static int cdns_uart_remove(struct platform_device *pdev)
+static void cdns_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 	struct cdns_uart *cdns_uart_data = port->private_data;
@@ -1692,12 +1692,11 @@ static int cdns_uart_remove(struct platform_device *pdev)
 
 	if (!--instances)
 		uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
-	return 0;
 }
 
 static struct platform_driver cdns_uart_platform_driver = {
 	.probe   = cdns_uart_probe,
-	.remove  = cdns_uart_remove,
+	.remove_new = cdns_uart_remove,
 	.driver  = {
 		.name = CDNS_UART_NAME,
 		.of_match_table = cdns_uart_of_match,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-11-10 17:49   ` Florian Fainelli
  2023-11-13  9:09   ` AngeloGioacchino Del Regno
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 27+ messages in thread
From: Florian Fainelli @ 2023-11-10 17:49 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Joel Stanley, Andrew Jeffery,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Al Cooper, Ilpo Järvinen, Andy Shevchenko, Paul Cercueil,
	Vladimir Zapolskiy, Matthias Brugger, AngeloGioacchino Del Regno,
	Thierry Reding, Jonathan Hunter, Kunihiko Hayashi,
	Masami Hiramatsu, John Ogness, Thomas Gleixner, Tony Lindgren,
	Petr Mladek, Biju Das, Johan Hovold, Chen-Yu Tsai, Andi Shyti,
	Thomas Richard, Rob Herring, Geert Uytterhoeven, Arnd Bergmann,
	Duje Mihanović, Rafael J. Wysocki, Jacob Keller,
	Christophe JAILLET, kernel, linux-serial, linux-arm-kernel,
	linux-aspeed, linux-rpi-kernel, linux-mips, linux-mediatek,
	linux-tegra


[-- Attachment #1.1: Type: text/plain, Size: 898 bytes --]

On 11/10/23 07:29, Uwe Kleine-König wrote:
> 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>
> ---

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> # 8250_bcm*
-- 
Florian


[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 08/52] serial: atmel: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
@ 2023-11-10 18:09   ` claudiu beznea
  2023-11-13 16:22   ` Richard Genoud
  1 sibling, 0 replies; 27+ messages in thread
From: claudiu beznea @ 2023-11-10 18:09 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Alexandre Belloni, linux-serial, Richard Genoud, kernel,
	linux-arm-kernel



On 10.11.2023 17:29, Uwe Kleine-König wrote:
> 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>

Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>

> ---
>  drivers/tty/serial/atmel_serial.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 1946fafc3f3e..6792680690bd 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -3001,7 +3001,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
>   * protocol that needs bitbanging on IO lines, but use the regular serial
>   * port in the normal case.
>   */
> -static int atmel_serial_remove(struct platform_device *pdev)
> +static void atmel_serial_remove(struct platform_device *pdev)
>  {
>  	struct uart_port *port = platform_get_drvdata(pdev);
>  	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> @@ -3020,8 +3020,6 @@ static int atmel_serial_remove(struct platform_device *pdev)
>  	clear_bit(port->line, atmel_ports_in_use);
>  
>  	pdev->dev.of_node = NULL;
> -
> -	return 0;
>  }
>  
>  static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
> @@ -3029,7 +3027,7 @@ static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
>  
>  static struct platform_driver atmel_serial_driver = {
>  	.probe		= atmel_serial_probe,
> -	.remove		= atmel_serial_remove,
> +	.remove_new	= atmel_serial_remove,
>  	.driver		= {
>  		.name			= "atmel_usart_serial",
>  		.of_match_table		= of_match_ptr(atmel_serial_dt_ids),

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 34/52] serial: samsung: Convert to platform remove callback returning void
  2023-11-10 15:30 ` [PATCH 34/52] serial: samsung: " Uwe Kleine-König
@ 2023-11-12  7:48   ` Krzysztof Kozlowski
  2023-11-12  9:09     ` Uwe Kleine-König
  0 siblings, 1 reply; 27+ messages in thread
From: Krzysztof Kozlowski @ 2023-11-12  7:48 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Alim Akhtar, linux-arm-kernel, linux-samsung-soc, kernel,
	linux-serial

On 10/11/2023 16:30, Uwe Kleine-König wrote:
> 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.

Maybe let's trim the commit msg? Or convert all drivers at once if you
want to drop long explanation...

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 34/52] serial: samsung: Convert to platform remove callback returning void
  2023-11-12  7:48   ` Krzysztof Kozlowski
@ 2023-11-12  9:09     ` Uwe Kleine-König
  0 siblings, 0 replies; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-12  9:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, Jiri Slaby, kernel, linux-samsung-soc,
	linux-arm-kernel, Alim Akhtar, linux-serial


[-- Attachment #1.1: Type: text/plain, Size: 1625 bytes --]

On Sun, Nov 12, 2023 at 08:48:49AM +0100, Krzysztof Kozlowski wrote:
> On 10/11/2023 16:30, Uwe Kleine-König wrote:
> > 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.
> 
> Maybe let's trim the commit msg? Or convert all drivers at once if you
> want to drop long explanation...

I like the verbosity of the commit log. This way you have a chance to
understand its motivation by only looking at that single commit.

IMHO doing one commit per driver is also right: It simplifies review,
allows me to send patches to only the respective maintainers and so
annoy less, the people reviewing the changes can send a tag for the
driver change they look at only.

But I'm not religious about that and if Greg wants to squash the patches
together that's ok for me.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-10 17:49   ` Florian Fainelli
@ 2023-11-13  9:09   ` AngeloGioacchino Del Regno
  2023-11-13 10:15   ` Geert Uytterhoeven
  2023-11-22 23:23   ` Andi Shyti
  3 siblings, 0 replies; 27+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-11-13  9:09 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Joel Stanley, Andrew Jeffery, Florian Fainelli,
	Broadcom internal kernel review list, Ray Jui, Scott Branden,
	Al Cooper, Ilpo Järvinen, Andy Shevchenko, Paul Cercueil,
	Vladimir Zapolskiy, Matthias Brugger, Thierry Reding,
	Jonathan Hunter, Kunihiko Hayashi, Masami Hiramatsu, John Ogness,
	Thomas Gleixner, Tony Lindgren, Petr Mladek, Biju Das,
	Johan Hovold, Chen-Yu Tsai, Andi Shyti, Thomas Richard,
	Rob Herring, Geert Uytterhoeven, Arnd Bergmann,
	Duje Mihanović, Rafael J. Wysocki, Jacob Keller,
	Christophe JAILLET, kernel, linux-serial, linux-arm-kernel,
	linux-aspeed, linux-rpi-kernel, linux-mips, linux-mediatek,
	linux-tegra

Il 10/11/23 16:29, Uwe Kleine-König ha scritto:
> 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>

For MediaTek:

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 52/52] serial: xilinx_uartps: Convert to platform remove callback returning void
  2023-11-10 15:30 ` [PATCH 52/52] serial: xilinx_uartps: " Uwe Kleine-König
@ 2023-11-13  9:41   ` Michal Simek
  2023-11-13 10:03     ` Uwe Kleine-König
  0 siblings, 1 reply; 27+ messages in thread
From: Michal Simek @ 2023-11-13  9:41 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Petr Mladek, John Ogness, Ruan Jinjie, Julien Malik,
	Thomas Gleixner, kernel, linux-serial, linux-arm-kernel



On 11/10/23 16:30, Uwe Kleine-König wrote:
> 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>
> ---
>   drivers/tty/serial/xilinx_uartps.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> index 66a45a634158..6decf2b13340 100644
> --- a/drivers/tty/serial/xilinx_uartps.c
> +++ b/drivers/tty/serial/xilinx_uartps.c
> @@ -1666,7 +1666,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
>    *
>    * Return: 0 on success, negative errno otherwise

this line should be also removed.

>    */
> -static int cdns_uart_remove(struct platform_device *pdev)
> +static void cdns_uart_remove(struct platform_device *pdev)
>   {
>   	struct uart_port *port = platform_get_drvdata(pdev);
>   	struct cdns_uart *cdns_uart_data = port->private_data;
> @@ -1692,12 +1692,11 @@ static int cdns_uart_remove(struct platform_device *pdev)
>   
>   	if (!--instances)
>   		uart_unregister_driver(cdns_uart_data->cdns_uart_driver);
> -	return 0;
>   }
>   
>   static struct platform_driver cdns_uart_platform_driver = {
>   	.probe   = cdns_uart_probe,
> -	.remove  = cdns_uart_remove,
> +	.remove_new = cdns_uart_remove,
>   	.driver  = {
>   		.name = CDNS_UART_NAME,
>   		.of_match_table = cdns_uart_of_match,

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 52/52] serial: xilinx_uartps: Convert to platform remove callback returning void
  2023-11-13  9:41   ` Michal Simek
@ 2023-11-13 10:03     ` Uwe Kleine-König
  2023-11-13 14:31       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 27+ messages in thread
From: Uwe Kleine-König @ 2023-11-13 10:03 UTC (permalink / raw)
  To: Michal Simek, Greg Kroah-Hartman
  Cc: Jiri Slaby, Petr Mladek, linux-serial, John Ogness, Ruan Jinjie,
	Julien Malik, kernel, Thomas Gleixner, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1978 bytes --]

On Mon, Nov 13, 2023 at 10:41:17AM +0100, Michal Simek wrote:
> 
> 
> On 11/10/23 16:30, Uwe Kleine-König wrote:
> > 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>
> > ---
> >   drivers/tty/serial/xilinx_uartps.c | 5 ++---
> >   1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> > index 66a45a634158..6decf2b13340 100644
> > --- a/drivers/tty/serial/xilinx_uartps.c
> > +++ b/drivers/tty/serial/xilinx_uartps.c
> > @@ -1666,7 +1666,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
> >    *
> >    * Return: 0 on success, negative errno otherwise
> 
> this line should be also removed.

Good catch.

@gregkh: What is the preferred way to address that? I can follow up with
a patch on top of this one (and you squash it or not), I can send a
patch that gets that does the conversion and drops the comment (and you
skip this incomplete patch when applying this series) or I can resend
the whole series in a week or so.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-10 17:49   ` Florian Fainelli
  2023-11-13  9:09   ` AngeloGioacchino Del Regno
@ 2023-11-13 10:15   ` Geert Uytterhoeven
  2023-11-22 23:23   ` Andi Shyti
  3 siblings, 0 replies; 27+ messages in thread
From: Geert Uytterhoeven @ 2023-11-13 10:15 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Joel Stanley, Andrew Jeffery,
	Florian Fainelli, Broadcom internal kernel review list, Ray Jui,
	Scott Branden, Al Cooper, Ilpo Järvinen, Andy Shevchenko,
	Paul Cercueil, Vladimir Zapolskiy, Matthias Brugger,
	AngeloGioacchino Del Regno, Thierry Reding, Jonathan Hunter,
	Kunihiko Hayashi, Masami Hiramatsu, John Ogness, Thomas Gleixner,
	Tony Lindgren, Petr Mladek, Biju Das, Johan Hovold, Chen-Yu Tsai,
	Andi Shyti, Thomas Richard, Rob Herring, Arnd Bergmann,
	Duje Mihanović, Rafael J. Wysocki, Jacob Keller,
	Christophe JAILLET, kernel, linux-serial, linux-arm-kernel,
	linux-aspeed, linux-rpi-kernel, linux-mips, linux-mediatek,
	linux-tegra

On Fri, Nov 10, 2023 at 4:31 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> 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>

>  drivers/tty/serial/8250/8250_dw.c           | 6 ++----
>  drivers/tty/serial/8250/8250_em.c           | 5 ++---

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 52/52] serial: xilinx_uartps: Convert to platform remove callback returning void
  2023-11-13 10:03     ` Uwe Kleine-König
@ 2023-11-13 14:31       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 27+ messages in thread
From: Greg Kroah-Hartman @ 2023-11-13 14:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Michal Simek, Jiri Slaby, Petr Mladek, linux-serial, John Ogness,
	Ruan Jinjie, Julien Malik, kernel, Thomas Gleixner,
	linux-arm-kernel

On Mon, Nov 13, 2023 at 11:03:42AM +0100, Uwe Kleine-König wrote:
> On Mon, Nov 13, 2023 at 10:41:17AM +0100, Michal Simek wrote:
> > 
> > 
> > On 11/10/23 16:30, Uwe Kleine-König wrote:
> > > 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>
> > > ---
> > >   drivers/tty/serial/xilinx_uartps.c | 5 ++---
> > >   1 file changed, 2 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
> > > index 66a45a634158..6decf2b13340 100644
> > > --- a/drivers/tty/serial/xilinx_uartps.c
> > > +++ b/drivers/tty/serial/xilinx_uartps.c
> > > @@ -1666,7 +1666,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
> > >    *
> > >    * Return: 0 on success, negative errno otherwise
> > 
> > this line should be also removed.
> 
> Good catch.
> 
> @gregkh: What is the preferred way to address that? I can follow up with
> a patch on top of this one (and you squash it or not), I can send a
> patch that gets that does the conversion and drops the comment (and you
> skip this incomplete patch when applying this series) or I can resend
> the whole series in a week or so.

Follow-on patch is fine, I'll take this whole series in a week when I
catch up from the merge-window-backlog as I'm at the Plumbers conference
this week...

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 08/52] serial: atmel: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
  2023-11-10 18:09   ` claudiu beznea
@ 2023-11-13 16:22   ` Richard Genoud
  1 sibling, 0 replies; 27+ messages in thread
From: Richard Genoud @ 2023-11-13 16:22 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Alexandre Belloni, kernel, Richard Genoud, Claudiu Beznea,
	linux-serial, linux-arm-kernel



Le 10/11/2023 à 16:29, Uwe Kleine-König a écrit :
> 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>
Acked-by: Richard Genoud <richard.genoud@gmail.com>

> ---
>   drivers/tty/serial/atmel_serial.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 1946fafc3f3e..6792680690bd 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -3001,7 +3001,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
>    * protocol that needs bitbanging on IO lines, but use the regular serial
>    * port in the normal case.
>    */
> -static int atmel_serial_remove(struct platform_device *pdev)
> +static void atmel_serial_remove(struct platform_device *pdev)
>   {
>   	struct uart_port *port = platform_get_drvdata(pdev);
>   	struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
> @@ -3020,8 +3020,6 @@ static int atmel_serial_remove(struct platform_device *pdev)
>   	clear_bit(port->line, atmel_ports_in_use);
>   
>   	pdev->dev.of_node = NULL;
> -
> -	return 0;
>   }
>   
>   static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
> @@ -3029,7 +3027,7 @@ static SIMPLE_DEV_PM_OPS(atmel_serial_pm_ops, atmel_serial_suspend,
>   
>   static struct platform_driver atmel_serial_driver = {
>   	.probe		= atmel_serial_probe,
> -	.remove		= atmel_serial_remove,
> +	.remove_new	= atmel_serial_remove,
>   	.driver		= {
>   		.name			= "atmel_usart_serial",
>   		.of_match_table		= of_match_ptr(atmel_serial_dt_ids),

Thanks !

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
                     ` (2 preceding siblings ...)
  2023-11-13 10:15   ` Geert Uytterhoeven
@ 2023-11-22 23:23   ` Andi Shyti
  3 siblings, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-11-22 23:23 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Joel Stanley, Andrew Jeffery,
	Florian Fainelli, Broadcom internal kernel review list, Ray Jui,
	Scott Branden, Al Cooper, Ilpo Järvinen, Andy Shevchenko,
	Paul Cercueil, Vladimir Zapolskiy, Matthias Brugger,
	AngeloGioacchino Del Regno, Thierry Reding, Jonathan Hunter,
	Kunihiko Hayashi, Masami Hiramatsu, John Ogness, Thomas Gleixner,
	Tony Lindgren, Petr Mladek, Biju Das, Johan Hovold, Chen-Yu Tsai,
	Andi Shyti, Thomas Richard, Rob Herring, Geert Uytterhoeven,
	Arnd Bergmann, Duje Mihanović, Rafael J. Wysocki,
	Jacob Keller, Christophe JAILLET, kernel, linux-serial,
	linux-arm-kernel, linux-aspeed, linux-rpi-kernel, linux-mips,
	linux-mediatek, linux-tegra

Hi Uwe,

On Fri, Nov 10, 2023 at 04:29:31PM +0100, Uwe Kleine-König wrote:
> 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>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>

Thanks,
Andi

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-11-22 23:24 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231110152927.70601-1-u.kleine-koenig@pengutronix.de>
2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-10 17:49   ` Florian Fainelli
2023-11-13  9:09   ` AngeloGioacchino Del Regno
2023-11-13 10:15   ` Geert Uytterhoeven
2023-11-22 23:23   ` Andi Shyti
2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
2023-11-10 18:09   ` claudiu beznea
2023-11-13 16:22   ` Richard Genoud
2023-11-10 15:29 ` [PATCH 10/52] serial: clps711x: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 12/52] serial: digicolor: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 17/52] serial: imx: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 20/52] serial: lpc32xx_hs: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 21/52] serial: ma35d1: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 23/52] serial: meson: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 24/52] serial: milbeaut_usio: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 27/52] serial: mxs-auart: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 32/52] serial: rda: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 34/52] serial: samsung: " Uwe Kleine-König
2023-11-12  7:48   ` Krzysztof Kozlowski
2023-11-12  9:09     ` Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 41/52] serial: st-asc: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 42/52] serial: stm32: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 52/52] serial: xilinx_uartps: " Uwe Kleine-König
2023-11-13  9:41   ` Michal Simek
2023-11-13 10:03     ` Uwe Kleine-König
2023-11-13 14:31       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).