Linux-Serial Archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/52] serial: Convert to platform remove callback returning void
@ 2023-11-10 15:29 Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed Uwe Kleine-König
                   ` (51 more replies)
  0 siblings, 52 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Tony Lindgren, Alexander Shiyan
  Cc: John Ogness, Ilpo Järvinen, Thomas Richard, Arnd Bergmann,
	Thomas Gleixner, kernel, linux-serial, Richard GENOUD,
	Christophe JAILLET, Yangtao Li, Joel Stanley, Andrew Jeffery,
	Florian Fainelli, Broadcom internal kernel review list, Ray Jui,
	Scott Branden, Al Cooper, Andy Shevchenko, Paul Cercueil,
	Vladimir Zapolskiy, Matthias Brugger, AngeloGioacchino Del Regno,
	Thierry Reding, Jonathan Hunter, Kunihiko Hayashi,
	Masami Hiramatsu, Petr Mladek, Biju Das, Johan Hovold,
	Chen-Yu Tsai, Andi Shyti, Rob Herring, Geert Uytterhoeven,
	Duje Mihanović, Rafael J. Wysocki, Jacob Keller,
	linux-arm-kernel, linux-aspeed, linux-rpi-kernel, linux-mips,
	linux-mediatek, linux-tegra, Tobias Klauser, Russell King,
	Lino Sanfilippo, Jiamei Xie, Hongyu Xie, delisun, Fabio Estevam,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Arend van Spriel, Maciej W. Rozycki, Christophe Leroy,
	Baruch Siach, Thierry Reding, Max Filippov, Zhang Shurong,
	Sherry Sun, Shenwei Wang, Shawn Guo, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, Sergey Organov, Tom Rix, Martin Fuzzey,
	Bernhard Seibold, Karol Gugala, Mateusz Holenko, Gabriel Somlo,
	Jacky Huang, Shan-Chun Hung, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Dmitry Rokosov, Lucas Tanure,
	Pavel Krasavin, linux-amlogic, Taichi Sugaya, Takao Orito,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	Andreas Färber, Manivannan Sadhasivam, linux-actions,
	Yuan Can, linux-unisoc, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Laxman Dewangan, Geert Uytterhoeven,
	Palmer Dabbelt, Paul Walmsley, Ben Dooks, Nick Hu, Samuel Holland,
	Ruan Jinjie, linux-riscv, Orson Zhai, Baolin Wang, Chunyan Zhang,
	Patrice Chotard, Maxime Coquelin, Alexandre Torgue,
	Valentin Caron, Marek Vasut, Sebastian Andrzej Siewior,
	Erwan Le Ray, linux-stm32, David S. Miller, sparclinux,
	Hammer Hsieh, Peter Korsgaard, Timur Tabi, linuxppc-dev,
	Michal Simek, Julien Malik

Hello,

this series starts with two fixes. The first one fixes a resource leak
and use after free. The second only improves error reporting. I added a
Fixes: marker to these. I let you decide if you want to drop them (or
the second only) or add a Cc: stable (to both or only the first one).

After that all drivers below drivers/tty/serial are converted to struct
platform_driver::remove_new. See commit 5c5a7680e67b ("platform: Provide
a remove callback that returns no value") for an extended explanation
and the eventual goal. The TL;DR; is to prevent bugs like the two fixed
here.

After these two fixes all conversations are trivial, because all
.remove() callbacks returned zero unconditionally.

The conversion patches are merge window material. The two fixes might go
in also before v6.7, but given the fixed problems are already old
(v6.1-rc6 + v3.10-rc1) there is probably no urge.

Best regards
Uwe

Uwe Kleine-König (52):
  serial: 8250: omap: Don't skip resource freeing if
    pm_runtime_resume_and_get() failed
  serial: sccnxp: Improve error message if regulator_disable() fails
  serial: 8250: Convert to platform remove callback returning void
  serial: altera_jtaguart: Convert to platform remove callback returning
    void
  serial: altera: Convert to platform remove callback returning void
  serial: amba-pl011: Convert to platform remove callback returning void
  serial: ar933x: Convert to platform remove callback returning void
  serial: atmel: Convert to platform remove callback returning void
  serial: bcm63xx: Convert to platform remove callback returning void
  serial: clps711x: Convert to platform remove callback returning void
  serial: cpm: Convert to platform remove callback returning void
  serial: digicolor: Convert to platform remove callback returning void
  serial: esp32_acm: Convert to platform remove callback returning void
  serial: esp32: Convert to platform remove callback returning void
  serial: fsl_linflexuart: Convert to platform remove callback returning
    void
  serial: fsl_lpuart: Convert to platform remove callback returning void
  serial: imx: Convert to platform remove callback returning void
  serial: lantiq: Convert to platform remove callback returning void
  serial: liteuart: Convert to platform remove callback returning void
  serial: lpc32xx_hs: Convert to platform remove callback returning void
  serial: ma35d1: Convert to platform remove callback returning void
  serial: mcf: Convert to platform remove callback returning void
  serial: meson: Convert to platform remove callback returning void
  serial: milbeaut_usio: Convert to platform remove callback returning
    void
  serial: mpc52xx: Convert to platform remove callback returning void
  serial: msm: Convert to platform remove callback returning void
  serial: mxs-auart: Convert to platform remove callback returning void
  serial: omap: Convert to platform remove callback returning void
  serial: owl: Convert to platform remove callback returning void
  serial: pic32: Convert to platform remove callback returning void
  serial: qcom_geni: Convert to platform remove callback returning void
  serial: rda: Convert to platform remove callback returning void
  serial: sa1100: Convert to platform remove callback returning void
  serial: samsung: Convert to platform remove callback returning void
  serial: sccnxp: Convert to platform remove callback returning void
  serial: tegra: Convert to platform remove callback returning void
  serial: txx9: Convert to platform remove callback returning void
  serial: sh-sci: Convert to platform remove callback returning void
  serial: sifive: Convert to platform remove callback returning void
  serial: sprd: Convert to platform remove callback returning void
  serial: st-asc: Convert to platform remove callback returning void
  serial: stm32: Convert to platform remove callback returning void
  serial: sunhv: Convert to platform remove callback returning void
  serial: sunplus: Convert to platform remove callback returning void
  serial: sunsab: Convert to platform remove callback returning void
  serial: sunsu: Convert to platform remove callback returning void
  serial: sunzilog: Convert to platform remove callback returning void
  serial: tegra-tcu: Convert to platform remove callback returning void
  serial: timbuart: Convert to platform remove callback returning void
  serial: uartlite: Convert to platform remove callback returning void
  serial: ucc: Convert to platform remove callback returning void
  serial: xilinx_uartps: Convert to platform remove callback returning
    void

 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         |  7 +++----
 drivers/tty/serial/8250/8250_pxa.c          |  6 ++----
 drivers/tty/serial/8250/8250_tegra.c        |  6 ++----
 drivers/tty/serial/8250/8250_uniphier.c     |  6 ++----
 drivers/tty/serial/altera_jtaguart.c        |  6 ++----
 drivers/tty/serial/altera_uart.c            |  6 ++----
 drivers/tty/serial/amba-pl011.c             |  5 ++---
 drivers/tty/serial/ar933x_uart.c            |  6 ++----
 drivers/tty/serial/atmel_serial.c           |  6 ++----
 drivers/tty/serial/bcm63xx_uart.c           |  5 ++---
 drivers/tty/serial/clps711x.c               |  6 ++----
 drivers/tty/serial/cpm_uart.c               |  6 ++----
 drivers/tty/serial/digicolor-usart.c        |  6 ++----
 drivers/tty/serial/esp32_acm.c              |  5 ++---
 drivers/tty/serial/esp32_uart.c             |  6 ++----
 drivers/tty/serial/fsl_linflexuart.c        |  6 ++----
 drivers/tty/serial/fsl_lpuart.c             |  5 ++---
 drivers/tty/serial/imx.c                    |  6 ++----
 drivers/tty/serial/lantiq.c                 |  6 ++----
 drivers/tty/serial/liteuart.c               |  6 ++----
 drivers/tty/serial/lpc32xx_hs.c             |  6 ++----
 drivers/tty/serial/ma35d1_serial.c          |  5 ++---
 drivers/tty/serial/mcf.c                    |  6 ++----
 drivers/tty/serial/meson_uart.c             |  8 +++-----
 drivers/tty/serial/milbeaut_usio.c          |  6 ++----
 drivers/tty/serial/mpc52xx_uart.c           |  7 ++-----
 drivers/tty/serial/msm_serial.c             |  6 ++----
 drivers/tty/serial/mxs-auart.c              |  6 ++----
 drivers/tty/serial/omap-serial.c            |  6 ++----
 drivers/tty/serial/owl-uart.c               |  6 ++----
 drivers/tty/serial/pic32_uart.c             |  7 ++-----
 drivers/tty/serial/qcom_geni_serial.c       |  6 ++----
 drivers/tty/serial/rda-uart.c               |  6 ++----
 drivers/tty/serial/sa1100.c                 |  6 ++----
 drivers/tty/serial/samsung_tty.c            |  6 ++----
 drivers/tty/serial/sccnxp.c                 | 13 +++++++------
 drivers/tty/serial/serial-tegra.c           |  5 ++---
 drivers/tty/serial/serial_txx9.c            |  5 ++---
 drivers/tty/serial/sh-sci.c                 |  6 ++----
 drivers/tty/serial/sifive.c                 |  6 ++----
 drivers/tty/serial/sprd_serial.c            |  6 ++----
 drivers/tty/serial/st-asc.c                 |  6 ++----
 drivers/tty/serial/stm32-usart.c            |  6 ++----
 drivers/tty/serial/sunhv.c                  |  6 ++----
 drivers/tty/serial/sunplus-uart.c           |  6 ++----
 drivers/tty/serial/sunsab.c                 |  6 ++----
 drivers/tty/serial/sunsu.c                  |  6 ++----
 drivers/tty/serial/sunzilog.c               |  6 ++----
 drivers/tty/serial/tegra-tcu.c              |  6 ++----
 drivers/tty/serial/timbuart.c               |  6 ++----
 drivers/tty/serial/uartlite.c               |  5 ++---
 drivers/tty/serial/ucc_uart.c               |  6 ++----
 drivers/tty/serial/xilinx_uartps.c          |  5 ++---
 65 files changed, 137 insertions(+), 249 deletions(-)


base-commit: 8728c14129df7a6e29188a2e737b4774fb200953
-- 
2.42.0


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

* [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-13  9:49   ` Tony Lindgren
  2023-11-10 15:29 ` [PATCH 02/52] serial: sccnxp: Improve error message if regulator_disable() fails Uwe Kleine-König
                   ` (50 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Tony Lindgren
  Cc: John Ogness, Ilpo Järvinen, Thomas Richard, Arnd Bergmann,
	Thomas Gleixner, kernel, linux-serial

Returning an error code from .remove() makes the driver core emit the
little helpful error message:

	remove callback returned a non-zero value. This will be ignored.

and then remove the device anyhow. So all resources that were not freed
are leaked in this case. Skipping serial8250_unregister_port() has the
potential to keep enough of the UART around to trigger a use-after-free.

So replace the error return (and with it the little helpful error
message) by a more useful error message and continue to cleanup.

Fixes: e3f0c638f428 ("serial: 8250: omap: Fix unpaired pm_runtime_put_sync() in omap8250_remove()")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/8250/8250_omap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 2d42f485c987..661a83dbc11b 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -1592,7 +1592,7 @@ static int omap8250_remove(struct platform_device *pdev)
 
 	err = pm_runtime_resume_and_get(&pdev->dev);
 	if (err)
-		return err;
+		dev_err(&pdev->dev, "Failed to resume hardware\n");
 
 	up = serial8250_get_port(priv->line);
 	omap_8250_shutdown(&up->port);
-- 
2.42.0


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

* [PATCH 02/52] serial: sccnxp: Improve error message if regulator_disable() fails
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
       [not found]   ` <1699851843.639333963@f702.i.mail.ru>
  2023-11-10 15:29 ` [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (49 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Alexander Shiyan
  Cc: Richard GENOUD, Christophe JAILLET, Yangtao Li, kernel,
	linux-serial

Returning an error code from .remove() makes the driver core emit the
little helpful error message:

	remove callback returned a non-zero value. This will be ignored.

and then remove the device anyhow.

So replace the error return (and with it the little helpful error
message) by a more useful error message.

Fixes: 31815c08fc90 ("serial: sccnxp: Replace pdata.init/exit with regulator API")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/sccnxp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 2be2c1098025..8269b0fb3083 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -1036,8 +1036,11 @@ static int sccnxp_remove(struct platform_device *pdev)
 
 	uart_unregister_driver(&s->uart);
 
-	if (!IS_ERR(s->regulator))
-		return regulator_disable(s->regulator);
+	if (!IS_ERR(s->regulator)) {
+		int ret = regulator_disable(s->regulator);
+		if (ret)
+			dev_err(&pdev->dev, "Failed to disable regulator\n");
+	}
 
 	return 0;
 }
-- 
2.42.0


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

* [PATCH 03/52] serial: 8250: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 02/52] serial: sccnxp: Improve error message if regulator_disable() fails Uwe Kleine-König
@ 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 04/52] serial: altera_jtaguart: " Uwe Kleine-König
                   ` (48 subsequent siblings)
  51 siblings, 4 replies; 73+ 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


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

* [PATCH 04/52] serial: altera_jtaguart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  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-16 13:32   ` Tobias Klauser
  2023-11-10 15:29 ` [PATCH 05/52] serial: altera: " Uwe Kleine-König
                   ` (47 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Tobias Klauser, linux-serial, 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/altera_jtaguart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/altera_jtaguart.c b/drivers/tty/serial/altera_jtaguart.c
index 7090b251dd4d..effcba71ea77 100644
--- a/drivers/tty/serial/altera_jtaguart.c
+++ b/drivers/tty/serial/altera_jtaguart.c
@@ -425,7 +425,7 @@ static int altera_jtaguart_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int altera_jtaguart_remove(struct platform_device *pdev)
+static void altera_jtaguart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port;
 	int i = pdev->id;
@@ -436,8 +436,6 @@ static int altera_jtaguart_remove(struct platform_device *pdev)
 	port = &altera_jtaguart_ports[i];
 	uart_remove_one_port(&altera_jtaguart_driver, port);
 	iounmap(port->membase);
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -451,7 +449,7 @@ MODULE_DEVICE_TABLE(of, altera_jtaguart_match);
 
 static struct platform_driver altera_jtaguart_platform_driver = {
 	.probe	= altera_jtaguart_probe,
-	.remove	= altera_jtaguart_remove,
+	.remove_new = altera_jtaguart_remove,
 	.driver	= {
 		.name		= DRV_NAME,
 		.of_match_table	= of_match_ptr(altera_jtaguart_match),
-- 
2.42.0


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

* [PATCH 05/52] serial: altera: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 04/52] serial: altera_jtaguart: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-16 13:32   ` Tobias Klauser
  2023-11-10 15:29 ` [PATCH 06/52] serial: amba-pl011: " Uwe Kleine-König
                   ` (46 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Tobias Klauser, linux-serial, 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/altera_uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index 77835ac68df2..081bec31dbd8 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -595,7 +595,7 @@ static int altera_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int altera_uart_remove(struct platform_device *pdev)
+static void altera_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
@@ -604,8 +604,6 @@ static int altera_uart_remove(struct platform_device *pdev)
 		port->mapbase = 0;
 		iounmap(port->membase);
 	}
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -619,7 +617,7 @@ MODULE_DEVICE_TABLE(of, altera_uart_match);
 
 static struct platform_driver altera_uart_platform_driver = {
 	.probe	= altera_uart_probe,
-	.remove	= altera_uart_remove,
+	.remove_new = altera_uart_remove,
 	.driver	= {
 		.name		= DRV_NAME,
 		.of_match_table	= of_match_ptr(altera_uart_match),
-- 
2.42.0


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

* [PATCH 06/52] serial: amba-pl011: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 05/52] serial: altera: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 07/52] serial: ar933x: " Uwe Kleine-König
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Russell King, Rob Herring, Thomas Gleixner, Lino Sanfilippo,
	Jiamei Xie, Hongyu Xie, delisun, Fabio Estevam, 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/amba-pl011.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 61cc24cd90e4..374b4254e39b 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2939,13 +2939,12 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 	return pl011_register_port(uap);
 }
 
-static int sbsa_uart_remove(struct platform_device *pdev)
+static void sbsa_uart_remove(struct platform_device *pdev)
 {
 	struct uart_amba_port *uap = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&amba_reg, &uap->port);
 	pl011_unregister_port(uap);
-	return 0;
 }
 
 static const struct of_device_id sbsa_uart_of_match[] = {
@@ -2963,7 +2962,7 @@ MODULE_DEVICE_TABLE(acpi, sbsa_uart_acpi_match);
 
 static struct platform_driver arm_sbsa_uart_platform_driver = {
 	.probe		= sbsa_uart_probe,
-	.remove		= sbsa_uart_remove,
+	.remove_new	= sbsa_uart_remove,
 	.driver	= {
 		.name	= "sbsa-uart",
 		.pm	= &pl011_dev_pm_ops,
-- 
2.42.0


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

* [PATCH 07/52] serial: ar933x: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 06/52] serial: amba-pl011: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 08/52] serial: atmel: " Uwe Kleine-König
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: John Ogness, Yangtao Li, Thomas Gleixner, 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/ar933x_uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
index ffd234673177..8d09ace062e5 100644
--- a/drivers/tty/serial/ar933x_uart.c
+++ b/drivers/tty/serial/ar933x_uart.c
@@ -818,7 +818,7 @@ static int ar933x_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ar933x_uart_remove(struct platform_device *pdev)
+static void ar933x_uart_remove(struct platform_device *pdev)
 {
 	struct ar933x_uart_port *up;
 
@@ -828,8 +828,6 @@ static int ar933x_uart_remove(struct platform_device *pdev)
 		uart_remove_one_port(&ar933x_uart_driver, &up->port);
 		clk_disable_unprepare(up->clk);
 	}
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -842,7 +840,7 @@ MODULE_DEVICE_TABLE(of, ar933x_uart_of_ids);
 
 static struct platform_driver ar933x_uart_platform_driver = {
 	.probe		= ar933x_uart_probe,
-	.remove		= ar933x_uart_remove,
+	.remove_new	= ar933x_uart_remove,
 	.driver		= {
 		.name		= DRIVER_NAME,
 		.of_match_table = of_match_ptr(ar933x_uart_of_ids),
-- 
2.42.0


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

* [PATCH 08/52] serial: atmel: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 07/52] serial: ar933x: " 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 09/52] serial: bcm63xx: " Uwe Kleine-König
                   ` (43 subsequent siblings)
  51 siblings, 2 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Richard Genoud, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	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/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


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

* [PATCH 09/52] serial: bcm63xx: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  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 17:03   ` Florian Fainelli
  2023-11-10 15:29 ` [PATCH 10/52] serial: clps711x: " Uwe Kleine-König
                   ` (42 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thomas Gleixner, Florian Fainelli, John Ogness, Arend van Spriel,
	Yangtao Li, 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/bcm63xx_uart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 4a08fd5ee61b..a3cefa153456 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -868,7 +868,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int bcm_uart_remove(struct platform_device *pdev)
+static void bcm_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port;
 
@@ -876,7 +876,6 @@ static int bcm_uart_remove(struct platform_device *pdev)
 	uart_remove_one_port(&bcm_uart_driver, port);
 	/* mark port as free */
 	ports[pdev->id].membase = NULL;
-	return 0;
 }
 
 static const struct of_device_id bcm63xx_of_match[] = {
@@ -890,7 +889,7 @@ MODULE_DEVICE_TABLE(of, bcm63xx_of_match);
  */
 static struct platform_driver bcm_uart_platform_driver = {
 	.probe	= bcm_uart_probe,
-	.remove	= bcm_uart_remove,
+	.remove_new = bcm_uart_remove,
 	.driver	= {
 		.name  = "bcm63xx_uart",
 		.of_match_table = bcm63xx_of_match,
-- 
2.42.0


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

* [PATCH 10/52] serial: clps711x: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 09/52] serial: bcm63xx: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 11/52] serial: cpm: " Uwe Kleine-König
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 11/52] serial: cpm: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 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 12/52] serial: digicolor: " Uwe Kleine-König
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Christophe Leroy, Thomas Gleixner, Ilpo Järvinen, 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/cpm_uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/cpm_uart.c b/drivers/tty/serial/cpm_uart.c
index be4af6eda4c2..df56c6c5afd0 100644
--- a/drivers/tty/serial/cpm_uart.c
+++ b/drivers/tty/serial/cpm_uart.c
@@ -1549,13 +1549,11 @@ static int cpm_uart_probe(struct platform_device *ofdev)
 	return ret;
 }
 
-static int cpm_uart_remove(struct platform_device *ofdev)
+static void cpm_uart_remove(struct platform_device *ofdev)
 {
 	struct uart_cpm_port *pinfo = platform_get_drvdata(ofdev);
 
 	uart_remove_one_port(&cpm_reg, &pinfo->port);
-
-	return 0;
 }
 
 static const struct of_device_id cpm_uart_match[] = {
@@ -1581,7 +1579,7 @@ static struct platform_driver cpm_uart_driver = {
 		.of_match_table = cpm_uart_match,
 	},
 	.probe = cpm_uart_probe,
-	.remove = cpm_uart_remove,
+	.remove_new = cpm_uart_remove,
  };
 
 static int __init cpm_uart_init(void)
-- 
2.42.0


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

* [PATCH 12/52] serial: digicolor: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 11/52] serial: cpm: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 13/52] serial: esp32_acm: " Uwe Kleine-König
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 13/52] serial: esp32_acm: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 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 14/52] serial: esp32: " Uwe Kleine-König
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Max Filippov, 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/esp32_acm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/esp32_acm.c b/drivers/tty/serial/esp32_acm.c
index cb28a87736aa..a4cbaedb5170 100644
--- a/drivers/tty/serial/esp32_acm.c
+++ b/drivers/tty/serial/esp32_acm.c
@@ -413,18 +413,17 @@ static int esp32s3_acm_probe(struct platform_device *pdev)
 	return uart_add_one_port(&esp32s3_acm_reg, port);
 }
 
-static int esp32s3_acm_remove(struct platform_device *pdev)
+static void esp32s3_acm_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&esp32s3_acm_reg, port);
-	return 0;
 }
 
 
 static struct platform_driver esp32s3_acm_driver = {
 	.probe		= esp32s3_acm_probe,
-	.remove		= esp32s3_acm_remove,
+	.remove_new	= esp32s3_acm_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.of_match_table	= esp32s3_acm_dt_ids,
-- 
2.42.0


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

* [PATCH 14/52] serial: esp32: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 13/52] serial: esp32_acm: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 15/52] serial: fsl_linflexuart: " Uwe Kleine-König
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Max Filippov, 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/esp32_uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/esp32_uart.c b/drivers/tty/serial/esp32_uart.c
index 85c9c5ad7cc5..6e12955d1315 100644
--- a/drivers/tty/serial/esp32_uart.c
+++ b/drivers/tty/serial/esp32_uart.c
@@ -737,19 +737,17 @@ static int esp32_uart_probe(struct platform_device *pdev)
 	return uart_add_one_port(&esp32_uart_reg, port);
 }
 
-static int esp32_uart_remove(struct platform_device *pdev)
+static void esp32_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&esp32_uart_reg, port);
-
-	return 0;
 }
 
 
 static struct platform_driver esp32_uart_driver = {
 	.probe		= esp32_uart_probe,
-	.remove		= esp32_uart_remove,
+	.remove_new	= esp32_uart_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.of_match_table	= esp32_uart_dt_ids,
-- 
2.42.0


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

* [PATCH 15/52] serial: fsl_linflexuart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 14/52] serial: esp32: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 16/52] serial: fsl_lpuart: " Uwe Kleine-König
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Zhang Shurong, John Ogness, Yangtao Li, Thomas Gleixner,
	Rob Herring, 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/fsl_linflexuart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/fsl_linflexuart.c b/drivers/tty/serial/fsl_linflexuart.c
index 3bdaf1ddc309..52c87876a88d 100644
--- a/drivers/tty/serial/fsl_linflexuart.c
+++ b/drivers/tty/serial/fsl_linflexuart.c
@@ -851,13 +851,11 @@ static int linflex_probe(struct platform_device *pdev)
 	return uart_add_one_port(&linflex_reg, sport);
 }
 
-static int linflex_remove(struct platform_device *pdev)
+static void linflex_remove(struct platform_device *pdev)
 {
 	struct uart_port *sport = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&linflex_reg, sport);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -884,7 +882,7 @@ static SIMPLE_DEV_PM_OPS(linflex_pm_ops, linflex_suspend, linflex_resume);
 
 static struct platform_driver linflex_driver = {
 	.probe		= linflex_probe,
-	.remove		= linflex_remove,
+	.remove_new	= linflex_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.of_match_table	= linflex_dt_ids,
-- 
2.42.0


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

* [PATCH 16/52] serial: fsl_lpuart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 15/52] serial: fsl_linflexuart: " 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
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Sherry Sun, Shenwei Wang, Ilpo Järvinen, Thomas Gleixner,
	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/fsl_lpuart.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 6d0cfb2e86b4..5ddf110aedbe 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -2959,7 +2959,7 @@ static int lpuart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int lpuart_remove(struct platform_device *pdev)
+static void lpuart_remove(struct platform_device *pdev)
 {
 	struct lpuart_port *sport = platform_get_drvdata(pdev);
 
@@ -2976,7 +2976,6 @@ static int lpuart_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
-	return 0;
 }
 
 static int lpuart_runtime_suspend(struct device *dev)
@@ -3210,7 +3209,7 @@ static const struct dev_pm_ops lpuart_pm_ops = {
 
 static struct platform_driver lpuart_driver = {
 	.probe		= lpuart_probe,
-	.remove		= lpuart_remove,
+	.remove_new	= lpuart_remove,
 	.driver		= {
 		.name	= "fsl-lpuart",
 		.of_match_table = lpuart_dt_ids,
-- 
2.42.0


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

* [PATCH 17/52] serial: imx: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (15 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 16/52] serial: fsl_lpuart: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 18/52] serial: lantiq: " Uwe Kleine-König
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 18/52] serial: lantiq: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (16 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 19/52] serial: liteuart: " Uwe Kleine-König
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Bernhard Seibold, Rob Herring, Ilpo Järvinen, 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/lantiq.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/lantiq.c b/drivers/tty/serial/lantiq.c
index 3adb60c683f7..a0731773ce75 100644
--- a/drivers/tty/serial/lantiq.c
+++ b/drivers/tty/serial/lantiq.c
@@ -887,13 +887,11 @@ static int lqasc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int lqasc_remove(struct platform_device *pdev)
+static void lqasc_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&lqasc_reg, port);
-
-	return 0;
 }
 
 static const struct ltq_soc_data soc_data_lantiq = {
@@ -917,7 +915,7 @@ MODULE_DEVICE_TABLE(of, ltq_asc_match);
 
 static struct platform_driver lqasc_driver = {
 	.probe		= lqasc_probe,
-	.remove		= lqasc_remove,
+	.remove_new	= lqasc_remove,
 	.driver		= {
 		.name	= DRVNAME,
 		.of_match_table = ltq_asc_match,
-- 
2.42.0


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

* [PATCH 19/52] serial: liteuart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (17 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 18/52] serial: lantiq: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 18:09   ` Gabriel L. Somlo
  2023-11-10 15:29 ` [PATCH 20/52] serial: lpc32xx_hs: " Uwe Kleine-König
                   ` (32 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Karol Gugala, Mateusz Holenko, Gabriel Somlo, Joel Stanley,
	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/liteuart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
index a25ab1efe38f..3ce369f76349 100644
--- a/drivers/tty/serial/liteuart.c
+++ b/drivers/tty/serial/liteuart.c
@@ -336,15 +336,13 @@ static int liteuart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int liteuart_remove(struct platform_device *pdev)
+static void liteuart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 	unsigned int line = port->line;
 
 	uart_remove_one_port(&liteuart_driver, port);
 	xa_erase(&liteuart_array, line);
-
-	return 0;
 }
 
 static const struct of_device_id liteuart_of_match[] = {
@@ -355,7 +353,7 @@ MODULE_DEVICE_TABLE(of, liteuart_of_match);
 
 static struct platform_driver liteuart_platform_driver = {
 	.probe = liteuart_probe,
-	.remove = liteuart_remove,
+	.remove_new = liteuart_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = liteuart_of_match,
-- 
2.42.0


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

* [PATCH 20/52] serial: lpc32xx_hs: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (18 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 19/52] serial: liteuart: " 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
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 21/52] serial: ma35d1: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (19 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 22/52] serial: mcf: " Uwe Kleine-König
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 22/52] serial: mcf: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (20 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 23/52] serial: meson: " Uwe Kleine-König
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Maciej W. Rozycki, Thierry Reding, Tobias Klauser,
	Thomas Gleixner, 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/mcf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/mcf.c b/drivers/tty/serial/mcf.c
index 91b15243f6c6..8690a45239e0 100644
--- a/drivers/tty/serial/mcf.c
+++ b/drivers/tty/serial/mcf.c
@@ -627,7 +627,7 @@ static int mcf_probe(struct platform_device *pdev)
 
 /****************************************************************************/
 
-static int mcf_remove(struct platform_device *pdev)
+static void mcf_remove(struct platform_device *pdev)
 {
 	struct uart_port *port;
 	int i;
@@ -637,15 +637,13 @@ static int mcf_remove(struct platform_device *pdev)
 		if (port)
 			uart_remove_one_port(&mcf_driver, port);
 	}
-
-	return 0;
 }
 
 /****************************************************************************/
 
 static struct platform_driver mcf_platform_driver = {
 	.probe		= mcf_probe,
-	.remove		= mcf_remove,
+	.remove_new	= mcf_remove,
 	.driver		= {
 		.name	= "mcfuart",
 	},
-- 
2.42.0


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

* [PATCH 23/52] serial: meson: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (21 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 22/52] serial: mcf: " 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
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 24/52] serial: milbeaut_usio: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (22 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 25/52] serial: mpc52xx: " Uwe Kleine-König
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 25/52] serial: mpc52xx: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (23 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 26/52] serial: msm: " Uwe Kleine-König
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thomas Gleixner, Rob Herring, John Ogness, 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/mpc52xx_uart.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index a252465e745f..95dae5e27b28 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -1765,15 +1765,12 @@ static int mpc52xx_uart_of_probe(struct platform_device *op)
 	return 0;
 }
 
-static int
-mpc52xx_uart_of_remove(struct platform_device *op)
+static void mpc52xx_uart_of_remove(struct platform_device *op)
 {
 	struct uart_port *port = platform_get_drvdata(op);
 
 	if (port)
 		uart_remove_one_port(&mpc52xx_uart_driver, port);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -1846,7 +1843,7 @@ MODULE_DEVICE_TABLE(of, mpc52xx_uart_of_match);
 
 static struct platform_driver mpc52xx_uart_of_driver = {
 	.probe		= mpc52xx_uart_of_probe,
-	.remove		= mpc52xx_uart_of_remove,
+	.remove_new	= mpc52xx_uart_of_remove,
 #ifdef CONFIG_PM
 	.suspend	= mpc52xx_uart_of_suspend,
 	.resume		= mpc52xx_uart_of_resume,
-- 
2.42.0


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

* [PATCH 26/52] serial: msm: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (24 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 25/52] serial: mpc52xx: " 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
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm, 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/msm_serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 597264b546fd..7fc8f0b16aef 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1843,13 +1843,11 @@ static int msm_serial_probe(struct platform_device *pdev)
 	return uart_add_one_port(&msm_uart_driver, port);
 }
 
-static int msm_serial_remove(struct platform_device *pdev)
+static void msm_serial_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&msm_uart_driver, port);
-
-	return 0;
 }
 
 static const struct of_device_id msm_match_table[] = {
@@ -1882,7 +1880,7 @@ static const struct dev_pm_ops msm_serial_dev_pm_ops = {
 };
 
 static struct platform_driver msm_platform_driver = {
-	.remove = msm_serial_remove,
+	.remove_new = msm_serial_remove,
 	.probe = msm_serial_probe,
 	.driver = {
 		.name = "msm_serial",
-- 
2.42.0


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

* [PATCH 27/52] serial: mxs-auart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (25 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 26/52] serial: msm: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 28/52] serial: omap: " Uwe Kleine-König
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 28/52] serial: omap: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (26 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:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thierry Reding, Andy Shevchenko, Thomas Gleixner, Yangtao Li,
	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/omap-serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index ad4c1c5d0a7f..730755621879 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -1658,7 +1658,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int serial_omap_remove(struct platform_device *dev)
+static void serial_omap_remove(struct platform_device *dev)
 {
 	struct uart_omap_port *up = platform_get_drvdata(dev);
 
@@ -1670,8 +1670,6 @@ static int serial_omap_remove(struct platform_device *dev)
 	pm_runtime_disable(up->dev);
 	cpu_latency_qos_remove_request(&up->pm_qos_request);
 	device_init_wakeup(&dev->dev, false);
-
-	return 0;
 }
 
 /*
@@ -1808,7 +1806,7 @@ MODULE_DEVICE_TABLE(of, omap_serial_of_match);
 
 static struct platform_driver serial_omap_driver = {
 	.probe          = serial_omap_probe,
-	.remove         = serial_omap_remove,
+	.remove_new     = serial_omap_remove,
 	.driver		= {
 		.name	= OMAP_SERIAL_DRIVER_NAME,
 		.pm	= &serial_omap_dev_pm_ops,
-- 
2.42.0


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

* [PATCH 29/52] serial: owl: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (27 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 28/52] serial: omap: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 30/52] serial: pic32: " Uwe Kleine-König
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 30/52] serial: pic32: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (28 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
@ 2023-11-10 15:29 ` Uwe Kleine-König
  2023-11-10 15:29 ` [PATCH 31/52] serial: qcom_geni: " Uwe Kleine-König
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Petr Mladek, John Ogness, Yuan Can, Thomas Gleixner, Rob Herring,
	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/pic32_uart.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/pic32_uart.c b/drivers/tty/serial/pic32_uart.c
index 3a95bf5d55d3..bbb46e6e98a2 100644
--- a/drivers/tty/serial/pic32_uart.c
+++ b/drivers/tty/serial/pic32_uart.c
@@ -938,7 +938,7 @@ static int pic32_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int pic32_uart_remove(struct platform_device *pdev)
+static void pic32_uart_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
 	struct pic32_sport *sport = to_pic32_sport(port);
@@ -947,9 +947,6 @@ static int pic32_uart_remove(struct platform_device *pdev)
 	clk_disable_unprepare(sport->clk);
 	platform_set_drvdata(pdev, NULL);
 	pic32_sports[sport->idx] = NULL;
-
-	/* automatic unroll of sport and gpios */
-	return 0;
 }
 
 static const struct of_device_id pic32_serial_dt_ids[] = {
@@ -960,7 +957,7 @@ MODULE_DEVICE_TABLE(of, pic32_serial_dt_ids);
 
 static struct platform_driver pic32_uart_platform_driver = {
 	.probe		= pic32_uart_probe,
-	.remove		= pic32_uart_remove,
+	.remove_new	= pic32_uart_remove,
 	.driver		= {
 		.name	= PIC32_DEV_NAME,
 		.of_match_table	= of_match_ptr(pic32_serial_dt_ids),
-- 
2.42.0


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

* [PATCH 31/52] serial: qcom_geni: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (29 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 30/52] serial: pic32: " 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
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm, 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/qcom_geni_serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 7e78f97e8f43..e63a8fbe63bd 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1696,7 +1696,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int qcom_geni_serial_remove(struct platform_device *pdev)
+static void qcom_geni_serial_remove(struct platform_device *pdev)
 {
 	struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
 	struct uart_driver *drv = port->private_data.drv;
@@ -1704,8 +1704,6 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
 	dev_pm_clear_wake_irq(&pdev->dev);
 	device_init_wakeup(&pdev->dev, false);
 	uart_remove_one_port(drv, &port->uport);
-
-	return 0;
 }
 
 static int qcom_geni_serial_sys_suspend(struct device *dev)
@@ -1805,7 +1803,7 @@ static const struct of_device_id qcom_geni_serial_match_table[] = {
 MODULE_DEVICE_TABLE(of, qcom_geni_serial_match_table);
 
 static struct platform_driver qcom_geni_serial_platform_driver = {
-	.remove = qcom_geni_serial_remove,
+	.remove_new = qcom_geni_serial_remove,
 	.probe = qcom_geni_serial_probe,
 	.driver = {
 		.name = "qcom_geni_serial",
-- 
2.42.0


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

* [PATCH 32/52] serial: rda: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (30 preceding siblings ...)
  2023-11-10 15:29 ` [PATCH 31/52] serial: qcom_geni: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 33/52] serial: sa1100: " Uwe Kleine-König
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 33/52] serial: sa1100: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (31 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-10 15:30 ` [PATCH 34/52] serial: samsung: " Uwe Kleine-König
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: John Ogness, Tobias Klauser, Thierry Reding, Richard GENOUD,
	Thomas Gleixner, 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/sa1100.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sa1100.c b/drivers/tty/serial/sa1100.c
index be7bcd75d9f4..79c794fa6545 100644
--- a/drivers/tty/serial/sa1100.c
+++ b/drivers/tty/serial/sa1100.c
@@ -870,19 +870,17 @@ static int sa1100_serial_probe(struct platform_device *dev)
 	return 0;
 }
 
-static int sa1100_serial_remove(struct platform_device *pdev)
+static void sa1100_serial_remove(struct platform_device *pdev)
 {
 	struct sa1100_port *sport = platform_get_drvdata(pdev);
 
 	if (sport)
 		uart_remove_one_port(&sa1100_reg, &sport->port);
-
-	return 0;
 }
 
 static struct platform_driver sa11x0_serial_driver = {
 	.probe		= sa1100_serial_probe,
-	.remove		= sa1100_serial_remove,
+	.remove_new	= sa1100_serial_remove,
 	.suspend	= sa1100_serial_suspend,
 	.resume		= sa1100_serial_resume,
 	.driver		= {
-- 
2.42.0


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

* [PATCH 34/52] serial: samsung: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (32 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 33/52] serial: sa1100: " 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 35/52] serial: sccnxp: " Uwe Kleine-König
                   ` (17 subsequent siblings)
  51 siblings, 1 reply; 73+ 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


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

* [PATCH 35/52] serial: sccnxp: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (33 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 36/52] serial: tegra: " Uwe Kleine-König
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Maciej W. Rozycki, Yangtao Li, Thierry Reding, Christophe JAILLET,
	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/sccnxp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c
index 8269b0fb3083..f24217a560d7 100644
--- a/drivers/tty/serial/sccnxp.c
+++ b/drivers/tty/serial/sccnxp.c
@@ -1021,7 +1021,7 @@ static int sccnxp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sccnxp_remove(struct platform_device *pdev)
+static void sccnxp_remove(struct platform_device *pdev)
 {
 	int i;
 	struct sccnxp_port *s = platform_get_drvdata(pdev);
@@ -1041,8 +1041,6 @@ static int sccnxp_remove(struct platform_device *pdev)
 		if (ret)
 			dev_err(&pdev->dev, "Failed to disable regulator\n");
 	}
-
-	return 0;
 }
 
 static struct platform_driver sccnxp_uart_driver = {
@@ -1050,7 +1048,7 @@ static struct platform_driver sccnxp_uart_driver = {
 		.name	= SCCNXP_NAME,
 	},
 	.probe		= sccnxp_probe,
-	.remove		= sccnxp_remove,
+	.remove_new	= sccnxp_remove,
 	.id_table	= sccnxp_id_table,
 };
 module_platform_driver(sccnxp_uart_driver);
-- 
2.42.0


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

* [PATCH 36/52] serial: tegra: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (34 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 35/52] serial: sccnxp: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 37/52] serial: txx9: " Uwe Kleine-König
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Laxman Dewangan, Thierry Reding, Jonathan Hunter, kernel,
	linux-serial, 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/serial-tegra.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial-tegra.c b/drivers/tty/serial/serial-tegra.c
index 6d4006b41975..525f3a2f7bd4 100644
--- a/drivers/tty/serial/serial-tegra.c
+++ b/drivers/tty/serial/serial-tegra.c
@@ -1611,13 +1611,12 @@ 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_port *tup = platform_get_drvdata(pdev);
 	struct uart_port *u = &tup->uport;
 
 	uart_remove_one_port(&tegra_uart_driver, u);
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1644,7 +1643,7 @@ static const struct dev_pm_ops tegra_uart_pm_ops = {
 
 static struct platform_driver tegra_uart_platform_driver = {
 	.probe		= tegra_uart_probe,
-	.remove		= tegra_uart_remove,
+	.remove_new	= tegra_uart_remove,
 	.driver		= {
 		.name	= "serial-tegra",
 		.of_match_table = tegra_uart_of_match,
-- 
2.42.0


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

* [PATCH 37/52] serial: txx9: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (35 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 36/52] serial: tegra: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 38/52] serial: sh-sci: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thierry Reding, Tobias Klauser, Richard GENOUD, Thomas Gleixner,
	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/serial_txx9.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c
index eaa980722455..e1897894a4ef 100644
--- a/drivers/tty/serial/serial_txx9.c
+++ b/drivers/tty/serial/serial_txx9.c
@@ -1052,7 +1052,7 @@ static int serial_txx9_probe(struct platform_device *dev)
 /*
  * Remove serial ports registered against a platform device.
  */
-static int serial_txx9_remove(struct platform_device *dev)
+static void serial_txx9_remove(struct platform_device *dev)
 {
 	int i;
 
@@ -1062,7 +1062,6 @@ static int serial_txx9_remove(struct platform_device *dev)
 		if (up->dev == &dev->dev)
 			serial_txx9_unregister_port(i);
 	}
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -1097,7 +1096,7 @@ static int serial_txx9_resume(struct platform_device *dev)
 
 static struct platform_driver serial_txx9_plat_driver = {
 	.probe		= serial_txx9_probe,
-	.remove		= serial_txx9_remove,
+	.remove_new	= serial_txx9_remove,
 #ifdef CONFIG_PM
 	.suspend	= serial_txx9_suspend,
 	.resume		= serial_txx9_resume,
-- 
2.42.0


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

* [PATCH 38/52] serial: sh-sci: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (36 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 37/52] serial: txx9: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-13 10:17   ` Geert Uytterhoeven
  2023-11-10 15:30 ` [PATCH 39/52] serial: sifive: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Biju Das, Geert Uytterhoeven, John Ogness, Rob Herring,
	Thomas Gleixner, Krzysztof Kozlowski, 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/sh-sci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 84ab434c94ba..745023001510 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3190,7 +3190,7 @@ static struct uart_driver sci_uart_driver = {
 	.cons		= SCI_CONSOLE,
 };
 
-static int sci_remove(struct platform_device *dev)
+static void sci_remove(struct platform_device *dev)
 {
 	struct sci_port *port = platform_get_drvdata(dev);
 	unsigned int type = port->port.type;	/* uart_remove_... clears it */
@@ -3204,8 +3204,6 @@ static int sci_remove(struct platform_device *dev)
 		device_remove_file(&dev->dev, &dev_attr_rx_fifo_trigger);
 	if (type == PORT_SCIFA || type == PORT_SCIFB || type == PORT_HSCIF)
 		device_remove_file(&dev->dev, &dev_attr_rx_fifo_timeout);
-
-	return 0;
 }
 
 
@@ -3470,7 +3468,7 @@ static SIMPLE_DEV_PM_OPS(sci_dev_pm_ops, sci_suspend, sci_resume);
 
 static struct platform_driver sci_driver = {
 	.probe		= sci_probe,
-	.remove		= sci_remove,
+	.remove_new	= sci_remove,
 	.driver		= {
 		.name	= "sh-sci",
 		.pm	= &sci_dev_pm_ops,
-- 
2.42.0


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

* [PATCH 39/52] serial: sifive: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (37 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 38/52] serial: sh-sci: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 17:31   ` Samuel Holland
  2023-11-10 15:30 ` [PATCH 40/52] serial: sprd: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Palmer Dabbelt, Paul Walmsley, Ben Dooks, Nick Hu, Tobias Klauser,
	Samuel Holland, Ruan Jinjie, Thomas Gleixner, Yangtao Li, kernel,
	linux-serial, linux-riscv

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

diff --git a/drivers/tty/serial/sifive.c b/drivers/tty/serial/sifive.c
index b296e57a9dee..3541235a3ab6 100644
--- a/drivers/tty/serial/sifive.c
+++ b/drivers/tty/serial/sifive.c
@@ -1007,7 +1007,7 @@ static int sifive_serial_probe(struct platform_device *pdev)
 	return r;
 }
 
-static int sifive_serial_remove(struct platform_device *dev)
+static void sifive_serial_remove(struct platform_device *dev)
 {
 	struct sifive_serial_port *ssp = platform_get_drvdata(dev);
 
@@ -1015,8 +1015,6 @@ static int sifive_serial_remove(struct platform_device *dev)
 	uart_remove_one_port(&sifive_serial_uart_driver, &ssp->port);
 	free_irq(ssp->port.irq, ssp);
 	clk_notifier_unregister(ssp->clk, &ssp->clk_notifier);
-
-	return 0;
 }
 
 static int sifive_serial_suspend(struct device *dev)
@@ -1045,7 +1043,7 @@ MODULE_DEVICE_TABLE(of, sifive_serial_of_match);
 
 static struct platform_driver sifive_serial_platform_driver = {
 	.probe		= sifive_serial_probe,
-	.remove		= sifive_serial_remove,
+	.remove_new	= sifive_serial_remove,
 	.driver		= {
 		.name	= SIFIVE_SERIAL_NAME,
 		.pm = pm_sleep_ptr(&sifive_uart_pm_ops),
-- 
2.42.0


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

* [PATCH 40/52] serial: sprd: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (38 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 39/52] serial: sifive: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-13  2:20   ` Chunyan Zhang
  2023-11-10 15:30 ` [PATCH 41/52] serial: st-asc: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  51 siblings, 1 reply; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Orson Zhai, Baolin Wang, Chunyan Zhang, Richard GENOUD,
	Krzysztof Kozlowski, Thomas Gleixner, Yangtao Li, 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/sprd_serial.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index f257525f9299..15f14fa593da 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -1076,7 +1076,7 @@ static struct uart_driver sprd_uart_driver = {
 	.cons = SPRD_CONSOLE,
 };
 
-static int sprd_remove(struct platform_device *dev)
+static void sprd_remove(struct platform_device *dev)
 {
 	struct sprd_uart_port *sup = platform_get_drvdata(dev);
 
@@ -1089,8 +1089,6 @@ static int sprd_remove(struct platform_device *dev)
 
 	if (!sprd_ports_num)
 		uart_unregister_driver(&sprd_uart_driver);
-
-	return 0;
 }
 
 static bool sprd_uart_is_console(struct uart_port *uport)
@@ -1257,7 +1255,7 @@ MODULE_DEVICE_TABLE(of, serial_ids);
 
 static struct platform_driver sprd_platform_driver = {
 	.probe		= sprd_probe,
-	.remove		= sprd_remove,
+	.remove_new	= sprd_remove,
 	.driver		= {
 		.name	= "sprd_serial",
 		.of_match_table = serial_ids,
-- 
2.42.0


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

* [PATCH 41/52] serial: st-asc: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (39 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 40/52] serial: sprd: " 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
                   ` (10 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 42/52] serial: stm32: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (40 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 43/52] serial: sunhv: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  51 siblings, 0 replies; 73+ 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


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

* [PATCH 43/52] serial: sunhv: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (41 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-10 15:30 ` [PATCH 44/52] serial: sunplus: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: David S. Miller, sparclinux, 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/sunhv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunhv.c b/drivers/tty/serial/sunhv.c
index 5bfc0040f17b..8d612ab80680 100644
--- a/drivers/tty/serial/sunhv.c
+++ b/drivers/tty/serial/sunhv.c
@@ -595,7 +595,7 @@ static int hv_probe(struct platform_device *op)
 	return err;
 }
 
-static int hv_remove(struct platform_device *dev)
+static void hv_remove(struct platform_device *dev)
 {
 	struct uart_port *port = platform_get_drvdata(dev);
 
@@ -608,8 +608,6 @@ static int hv_remove(struct platform_device *dev)
 	kfree(con_write_page);
 	kfree(port);
 	sunhv_port = NULL;
-
-	return 0;
 }
 
 static const struct of_device_id hv_match[] = {
@@ -630,7 +628,7 @@ static struct platform_driver hv_driver = {
 		.of_match_table = hv_match,
 	},
 	.probe		= hv_probe,
-	.remove		= hv_remove,
+	.remove_new	= hv_remove,
 };
 
 static int __init sunhv_init(void)
-- 
2.42.0


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

* [PATCH 44/52] serial: sunplus: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (42 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 43/52] serial: sunhv: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 45/52] serial: sunsab: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Hammer Hsieh, 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/sunplus-uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunplus-uart.c b/drivers/tty/serial/sunplus-uart.c
index 4251f4e1ba99..99f5285819d4 100644
--- a/drivers/tty/serial/sunplus-uart.c
+++ b/drivers/tty/serial/sunplus-uart.c
@@ -662,13 +662,11 @@ static int sunplus_uart_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sunplus_uart_remove(struct platform_device *pdev)
+static void sunplus_uart_remove(struct platform_device *pdev)
 {
 	struct sunplus_uart_port *sup = platform_get_drvdata(pdev);
 
 	uart_remove_one_port(&sunplus_uart_driver, &sup->port);
-
-	return 0;
 }
 
 static int __maybe_unused sunplus_uart_suspend(struct device *dev)
@@ -703,7 +701,7 @@ MODULE_DEVICE_TABLE(of, sp_uart_of_match);
 
 static struct platform_driver sunplus_uart_platform_driver = {
 	.probe		= sunplus_uart_probe,
-	.remove		= sunplus_uart_remove,
+	.remove_new	= sunplus_uart_remove,
 	.driver = {
 		.name	= "sunplus_uart",
 		.of_match_table = sp_uart_of_match,
-- 
2.42.0


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

* [PATCH 45/52] serial: sunsab: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (43 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 44/52] serial: sunplus: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 46/52] serial: sunsu: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: David S. Miller, sparclinux, 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/sunsab.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index 6aa51a6f8063..ff557796b578 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1066,7 +1066,7 @@ static int sab_probe(struct platform_device *op)
 	return err;
 }
 
-static int sab_remove(struct platform_device *op)
+static void sab_remove(struct platform_device *op)
 {
 	struct uart_sunsab_port *up = platform_get_drvdata(op);
 
@@ -1078,8 +1078,6 @@ static int sab_remove(struct platform_device *op)
 	of_iounmap(&op->resource[0],
 		   up[0].port.membase,
 		   sizeof(union sab82532_async_regs));
-
-	return 0;
 }
 
 static const struct of_device_id sab_match[] = {
@@ -1100,7 +1098,7 @@ static struct platform_driver sab_driver = {
 		.of_match_table = sab_match,
 	},
 	.probe		= sab_probe,
-	.remove		= sab_remove,
+	.remove_new	= sab_remove,
 };
 
 static int __init sunsab_init(void)
-- 
2.42.0


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

* [PATCH 46/52] serial: sunsu: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (44 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 45/52] serial: sunsab: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 47/52] serial: sunzilog: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: David S. Miller, sparclinux, 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/sunsu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunsu.c b/drivers/tty/serial/sunsu.c
index 1e051cc2591c..c8b65f4b2710 100644
--- a/drivers/tty/serial/sunsu.c
+++ b/drivers/tty/serial/sunsu.c
@@ -1515,7 +1515,7 @@ static int su_probe(struct platform_device *op)
 	return err;
 }
 
-static int su_remove(struct platform_device *op)
+static void su_remove(struct platform_device *op)
 {
 	struct uart_sunsu_port *up = platform_get_drvdata(op);
 	bool kbdms = false;
@@ -1536,8 +1536,6 @@ static int su_remove(struct platform_device *op)
 
 	if (kbdms)
 		kfree(up);
-
-	return 0;
 }
 
 static const struct of_device_id su_match[] = {
@@ -1565,7 +1563,7 @@ static struct platform_driver su_driver = {
 		.of_match_table = su_match,
 	},
 	.probe		= su_probe,
-	.remove		= su_remove,
+	.remove_new	= su_remove,
 };
 
 static int __init sunsu_init(void)
-- 
2.42.0


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

* [PATCH 47/52] serial: sunzilog: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (45 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 46/52] serial: sunsu: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 48/52] serial: tegra-tcu: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: David S. Miller, sparclinux, 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/sunzilog.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c
index d3b5e864b727..c99289c6c8f8 100644
--- a/drivers/tty/serial/sunzilog.c
+++ b/drivers/tty/serial/sunzilog.c
@@ -1513,7 +1513,7 @@ static void zs_remove_one(struct uart_sunzilog_port *up)
 		uart_remove_one_port(&sunzilog_reg, &up->port);
 }
 
-static int zs_remove(struct platform_device *op)
+static void zs_remove(struct platform_device *op)
 {
 	struct uart_sunzilog_port *up = platform_get_drvdata(op);
 	struct zilog_layout __iomem *regs;
@@ -1523,8 +1523,6 @@ static int zs_remove(struct platform_device *op)
 
 	regs = sunzilog_chip_regs[up[0].port.line / 2];
 	of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout));
-
-	return 0;
 }
 
 static const struct of_device_id zs_match[] = {
@@ -1541,7 +1539,7 @@ static struct platform_driver zs_driver = {
 		.of_match_table = zs_match,
 	},
 	.probe		= zs_probe,
-	.remove		= zs_remove,
+	.remove_new	= zs_remove,
 };
 
 static int __init sunzilog_init(void)
-- 
2.42.0


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

* [PATCH 48/52] serial: tegra-tcu: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (46 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 47/52] serial: sunzilog: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 49/52] serial: timbuart: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thierry Reding, Jonathan Hunter, Rob Herring, kernel,
	linux-serial, 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/tegra-tcu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/tegra-tcu.c b/drivers/tty/serial/tegra-tcu.c
index 65069daf36ec..d9c78320eb02 100644
--- a/drivers/tty/serial/tegra-tcu.c
+++ b/drivers/tty/serial/tegra-tcu.c
@@ -266,7 +266,7 @@ static int tegra_tcu_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int tegra_tcu_remove(struct platform_device *pdev)
+static void tegra_tcu_remove(struct platform_device *pdev)
 {
 	struct tegra_tcu *tcu = platform_get_drvdata(pdev);
 
@@ -277,8 +277,6 @@ static int tegra_tcu_remove(struct platform_device *pdev)
 	uart_remove_one_port(&tcu->driver, &tcu->port);
 	uart_unregister_driver(&tcu->driver);
 	mbox_free_channel(tcu->tx);
-
-	return 0;
 }
 
 static const struct of_device_id tegra_tcu_match[] = {
@@ -293,7 +291,7 @@ static struct platform_driver tegra_tcu_driver = {
 		.of_match_table = tegra_tcu_match,
 	},
 	.probe = tegra_tcu_probe,
-	.remove = tegra_tcu_remove,
+	.remove_new = tegra_tcu_remove,
 };
 module_platform_driver(tegra_tcu_driver);
 
-- 
2.42.0


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

* [PATCH 49/52] serial: timbuart: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (47 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 48/52] serial: tegra-tcu: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 50/52] serial: uartlite: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Thomas Gleixner, John Ogness, 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/timbuart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 0cc6524f5e8b..4bc89a9b380a 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -473,7 +473,7 @@ static int timbuart_probe(struct platform_device *dev)
 	return err;
 }
 
-static int timbuart_remove(struct platform_device *dev)
+static void timbuart_remove(struct platform_device *dev)
 {
 	struct timbuart_port *uart = platform_get_drvdata(dev);
 
@@ -481,8 +481,6 @@ static int timbuart_remove(struct platform_device *dev)
 	uart_remove_one_port(&timbuart_driver, &uart->port);
 	uart_unregister_driver(&timbuart_driver);
 	kfree(uart);
-
-	return 0;
 }
 
 static struct platform_driver timbuart_platform_driver = {
@@ -490,7 +488,7 @@ static struct platform_driver timbuart_platform_driver = {
 		.name	= "timb-uart",
 	},
 	.probe		= timbuart_probe,
-	.remove		= timbuart_remove,
+	.remove_new	= timbuart_remove,
 };
 
 module_platform_driver(timbuart_platform_driver);
-- 
2.42.0


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

* [PATCH 50/52] serial: uartlite: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (48 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 49/52] serial: timbuart: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 51/52] serial: ucc: " Uwe Kleine-König
  2023-11-10 15:30 ` [PATCH 52/52] serial: xilinx_uartps: " Uwe Kleine-König
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Peter Korsgaard, linux-serial, 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/uartlite.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index 404c14acafa5..48c9fca1566b 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -890,7 +890,7 @@ static int ulite_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ulite_remove(struct platform_device *pdev)
+static void ulite_remove(struct platform_device *pdev)
 {
 	struct uart_port *port = dev_get_drvdata(&pdev->dev);
 	struct uartlite_data *pdata = port->private_data;
@@ -900,7 +900,6 @@ static int ulite_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 	pm_runtime_dont_use_autosuspend(&pdev->dev);
-	return 0;
 }
 
 /* work with hotplug and coldplug */
@@ -908,7 +907,7 @@ MODULE_ALIAS("platform:uartlite");
 
 static struct platform_driver ulite_platform_driver = {
 	.probe = ulite_probe,
-	.remove = ulite_remove,
+	.remove_new = ulite_remove,
 	.driver = {
 		.name  = "uartlite",
 		.of_match_table = of_match_ptr(ulite_of_match),
-- 
2.42.0


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

* [PATCH 51/52] serial: ucc: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (49 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 50/52] serial: uartlite: " 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
  51 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-10 15:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Timur Tabi, linuxppc-dev, 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/ucc_uart.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index ed7a6bb5596a..f9ad942c9aaf 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -1459,7 +1459,7 @@ static int ucc_uart_probe(struct platform_device *ofdev)
 	return ret;
 }
 
-static int ucc_uart_remove(struct platform_device *ofdev)
+static void ucc_uart_remove(struct platform_device *ofdev)
 {
 	struct uart_qe_port *qe_port = platform_get_drvdata(ofdev);
 
@@ -1470,8 +1470,6 @@ static int ucc_uart_remove(struct platform_device *ofdev)
 	of_node_put(qe_port->np);
 
 	kfree(qe_port);
-
-	return 0;
 }
 
 static const struct of_device_id ucc_uart_match[] = {
@@ -1492,7 +1490,7 @@ static struct platform_driver ucc_uart_of_driver = {
 		.of_match_table    = ucc_uart_match,
 	},
 	.probe  	= ucc_uart_probe,
-	.remove 	= ucc_uart_remove,
+	.remove_new 	= ucc_uart_remove,
 };
 
 static int __init ucc_uart_init(void)
-- 
2.42.0


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

* [PATCH 52/52] serial: xilinx_uartps: Convert to platform remove callback returning void
  2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (50 preceding siblings ...)
  2023-11-10 15:30 ` [PATCH 51/52] serial: ucc: " Uwe Kleine-König
@ 2023-11-10 15:30 ` Uwe Kleine-König
  2023-11-13  9:41   ` Michal Simek
  51 siblings, 1 reply; 73+ 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


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

* Re: [PATCH 09/52] serial: bcm63xx: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 09/52] serial: bcm63xx: " Uwe Kleine-König
@ 2023-11-10 17:03   ` Florian Fainelli
  0 siblings, 0 replies; 73+ messages in thread
From: Florian Fainelli @ 2023-11-10 17:03 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Thomas Gleixner, John Ogness, Arend van Spriel, Yangtao Li,
	kernel, linux-serial

[-- Attachment #1: Type: text/plain, Size: 880 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>
-- 
Florian


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

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

* Re: [PATCH 39/52] serial: sifive: Convert to platform remove callback returning void
  2023-11-10 15:30 ` [PATCH 39/52] serial: sifive: " Uwe Kleine-König
@ 2023-11-10 17:31   ` Samuel Holland
  0 siblings, 0 replies; 73+ messages in thread
From: Samuel Holland @ 2023-11-10 17:31 UTC (permalink / raw)
  To: Uwe Kleine-König, Greg Kroah-Hartman, Jiri Slaby
  Cc: Palmer Dabbelt, Paul Walmsley, Ben Dooks, Nick Hu, Tobias Klauser,
	Ruan Jinjie, Thomas Gleixner, Yangtao Li, kernel, linux-serial,
	linux-riscv

On 2023-11-10 7:30 AM, 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/sifive.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Samuel Holland <samuel.holland@sifive.com>


^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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: 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 #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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: Richard Genoud, Nicolas Ferre, Alexandre Belloni, kernel,
	linux-serial, 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),

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

* Re: [PATCH 19/52] serial: liteuart: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 19/52] serial: liteuart: " Uwe Kleine-König
@ 2023-11-10 18:09   ` Gabriel L. Somlo
  0 siblings, 0 replies; 73+ messages in thread
From: Gabriel L. Somlo @ 2023-11-10 18:09 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Karol Gugala, Mateusz Holenko,
	Joel Stanley, kernel, linux-serial

On Fri, Nov 10, 2023 at 04:29:47PM +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>

Thanks!

Acked-by: Gabriel Somlo <gsomlo@gmail.com>

> ---
>  drivers/tty/serial/liteuart.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index a25ab1efe38f..3ce369f76349 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -336,15 +336,13 @@ static int liteuart_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int liteuart_remove(struct platform_device *pdev)
> +static void liteuart_remove(struct platform_device *pdev)
>  {
>  	struct uart_port *port = platform_get_drvdata(pdev);
>  	unsigned int line = port->line;
>  
>  	uart_remove_one_port(&liteuart_driver, port);
>  	xa_erase(&liteuart_array, line);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id liteuart_of_match[] = {
> @@ -355,7 +353,7 @@ MODULE_DEVICE_TABLE(of, liteuart_of_match);
>  
>  static struct platform_driver liteuart_platform_driver = {
>  	.probe = liteuart_probe,
> -	.remove = liteuart_remove,
> +	.remove_new = liteuart_remove,
>  	.driver = {
>  		.name = KBUILD_MODNAME,
>  		.of_match_table = liteuart_of_match,
> -- 
> 2.42.0
> 

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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


^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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: 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 40/52] serial: sprd: Convert to platform remove callback returning void
  2023-11-10 15:30 ` [PATCH 40/52] serial: sprd: " Uwe Kleine-König
@ 2023-11-13  2:20   ` Chunyan Zhang
  0 siblings, 0 replies; 73+ messages in thread
From: Chunyan Zhang @ 2023-11-13  2:20 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Orson Zhai, Baolin Wang,
	Richard GENOUD, Krzysztof Kozlowski, Thomas Gleixner, Yangtao Li,
	kernel, linux-serial

On Fri, 10 Nov 2023 at 23:30, 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>

Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
>  drivers/tty/serial/sprd_serial.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
> index f257525f9299..15f14fa593da 100644
> --- a/drivers/tty/serial/sprd_serial.c
> +++ b/drivers/tty/serial/sprd_serial.c
> @@ -1076,7 +1076,7 @@ static struct uart_driver sprd_uart_driver = {
>         .cons = SPRD_CONSOLE,
>  };
>
> -static int sprd_remove(struct platform_device *dev)
> +static void sprd_remove(struct platform_device *dev)
>  {
>         struct sprd_uart_port *sup = platform_get_drvdata(dev);
>
> @@ -1089,8 +1089,6 @@ static int sprd_remove(struct platform_device *dev)
>
>         if (!sprd_ports_num)
>                 uart_unregister_driver(&sprd_uart_driver);
> -
> -       return 0;
>  }
>
>  static bool sprd_uart_is_console(struct uart_port *uport)
> @@ -1257,7 +1255,7 @@ MODULE_DEVICE_TABLE(of, serial_ids);
>
>  static struct platform_driver sprd_platform_driver = {
>         .probe          = sprd_probe,
> -       .remove         = sprd_remove,
> +       .remove_new     = sprd_remove,
>         .driver         = {
>                 .name   = "sprd_serial",
>                 .of_match_table = serial_ids,
> --
> 2.42.0
>

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

* Re: [PATCH 02/52] serial: sccnxp: Improve error message if regulator_disable() fails
       [not found]   ` <1699851843.639333963@f702.i.mail.ru>
@ 2023-11-13  8:57     ` Uwe Kleine-König
  0 siblings, 0 replies; 73+ messages in thread
From: Uwe Kleine-König @ 2023-11-13  8:57 UTC (permalink / raw)
  To: Alexander Shiyan
  Cc: kernel, Yangtao Li, Richard GENOUD, Greg Kroah-Hartman,
	Christophe JAILLET, linux-serial, Jiri Slaby

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

On Mon, Nov 13, 2023 at 08:04:03AM +0300, Alexander Shiyan wrote:
> 
> Hello.
>  
> > Returning an error code from .remove() makes the driver core emit the
> > little helpful error message:
> > > remove callback returned a non-zero value. This will be ignored.
> > > and then remove the device anyhow.
> >
> > So replace the error return (and with it the little helpful error
> > message) by a more useful error message.
> ...
> > - if (!IS_ERR(s->regulator))
> > - return regulator_disable(s->regulator);
> > + if (!IS_ERR(s->regulator)) {
> > + int ret = regulator_disable(s->regulator);
> > + if (ret)
> > + dev_err(&pdev->dev, "Failed to disable regulator\n");
> > + }
> >  
> >   return 0;
>  
> return ret ?  

No, return 0 is right. Please look at platform_remove() in
drivers/base/platform.c and optionally reread the commit log to convince
yourself about that.

Best regards
Uwe

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

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

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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>


^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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

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

* Re: [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed
  2023-11-10 15:29 ` [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed Uwe Kleine-König
@ 2023-11-13  9:49   ` Tony Lindgren
  0 siblings, 0 replies; 73+ messages in thread
From: Tony Lindgren @ 2023-11-13  9:49 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, John Ogness, Ilpo Järvinen,
	Thomas Richard, Arnd Bergmann, Thomas Gleixner, kernel,
	linux-serial

* Uwe Kleine-König <u.kleine-koenig@pengutronix.de> [231110 15:30]:
> Returning an error code from .remove() makes the driver core emit the
> little helpful error message:
> 
> 	remove callback returned a non-zero value. This will be ignored.
> 
> and then remove the device anyhow. So all resources that were not freed
> are leaked in this case. Skipping serial8250_unregister_port() has the
> potential to keep enough of the UART around to trigger a use-after-free.
> 
> So replace the error return (and with it the little helpful error
> message) by a more useful error message and continue to cleanup.

Looks good to me thanks:

Reviewed-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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: 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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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

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

* Re: [PATCH 38/52] serial: sh-sci: Convert to platform remove callback returning void
  2023-11-10 15:30 ` [PATCH 38/52] serial: sh-sci: " Uwe Kleine-König
@ 2023-11-13 10:17   ` Geert Uytterhoeven
  0 siblings, 0 replies; 73+ messages in thread
From: Geert Uytterhoeven @ 2023-11-13 10:17 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, Biju Das, John Ogness,
	Rob Herring, Thomas Gleixner, Krzysztof Kozlowski, kernel,
	linux-serial

On Fri, Nov 10, 2023 at 4:30 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>

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

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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: Richard Genoud, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	kernel, 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 !

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

* Re: [PATCH 05/52] serial: altera: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 05/52] serial: altera: " Uwe Kleine-König
@ 2023-11-16 13:32   ` Tobias Klauser
  0 siblings, 0 replies; 73+ messages in thread
From: Tobias Klauser @ 2023-11-16 13:32 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, kernel

On 2023-11-10 at 16:29:33 +0100, 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>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

Thanks

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

* Re: [PATCH 04/52] serial: altera_jtaguart: Convert to platform remove callback returning void
  2023-11-10 15:29 ` [PATCH 04/52] serial: altera_jtaguart: " Uwe Kleine-König
@ 2023-11-16 13:32   ` Tobias Klauser
  0 siblings, 0 replies; 73+ messages in thread
From: Tobias Klauser @ 2023-11-16 13:32 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, kernel

On 2023-11-10 at 16:29:32 +0100, 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>

Acked-by: Tobias Klauser <tklauser@distanz.ch>

Thanks

^ permalink raw reply	[flat|nested] 73+ 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; 73+ 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

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

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

Thread overview: 73+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-10 15:29 [PATCH 00/52] serial: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 01/52] serial: 8250: omap: Don't skip resource freeing if pm_runtime_resume_and_get() failed Uwe Kleine-König
2023-11-13  9:49   ` Tony Lindgren
2023-11-10 15:29 ` [PATCH 02/52] serial: sccnxp: Improve error message if regulator_disable() fails Uwe Kleine-König
     [not found]   ` <1699851843.639333963@f702.i.mail.ru>
2023-11-13  8:57     ` Uwe Kleine-König
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 04/52] serial: altera_jtaguart: " Uwe Kleine-König
2023-11-16 13:32   ` Tobias Klauser
2023-11-10 15:29 ` [PATCH 05/52] serial: altera: " Uwe Kleine-König
2023-11-16 13:32   ` Tobias Klauser
2023-11-10 15:29 ` [PATCH 06/52] serial: amba-pl011: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 07/52] serial: ar933x: " Uwe Kleine-König
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 09/52] serial: bcm63xx: " Uwe Kleine-König
2023-11-10 17:03   ` Florian Fainelli
2023-11-10 15:29 ` [PATCH 10/52] serial: clps711x: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 11/52] serial: cpm: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 12/52] serial: digicolor: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 13/52] serial: esp32_acm: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 14/52] serial: esp32: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 15/52] serial: fsl_linflexuart: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 16/52] serial: fsl_lpuart: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 17/52] serial: imx: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 18/52] serial: lantiq: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 19/52] serial: liteuart: " Uwe Kleine-König
2023-11-10 18:09   ` Gabriel L. Somlo
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 22/52] serial: mcf: " 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 25/52] serial: mpc52xx: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 26/52] serial: msm: " 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 28/52] serial: omap: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 29/52] serial: owl: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 30/52] serial: pic32: " Uwe Kleine-König
2023-11-10 15:29 ` [PATCH 31/52] serial: qcom_geni: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 32/52] serial: rda: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 33/52] serial: sa1100: " 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 35/52] serial: sccnxp: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 36/52] serial: tegra: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 37/52] serial: txx9: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 38/52] serial: sh-sci: " Uwe Kleine-König
2023-11-13 10:17   ` Geert Uytterhoeven
2023-11-10 15:30 ` [PATCH 39/52] serial: sifive: " Uwe Kleine-König
2023-11-10 17:31   ` Samuel Holland
2023-11-10 15:30 ` [PATCH 40/52] serial: sprd: " Uwe Kleine-König
2023-11-13  2:20   ` Chunyan Zhang
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 43/52] serial: sunhv: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 44/52] serial: sunplus: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 45/52] serial: sunsab: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 46/52] serial: sunsu: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 47/52] serial: sunzilog: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 48/52] serial: tegra-tcu: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 49/52] serial: timbuart: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 50/52] serial: uartlite: " Uwe Kleine-König
2023-11-10 15:30 ` [PATCH 51/52] serial: ucc: " 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 read-only IMAP folder(s) and NNTP newsgroup(s).