All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Helge Deller <deller@gmx.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, kernel@pengutronix.de
Subject: [PATCH 14/22] fb: omapfb/analog-tv: Convert to platform remove callback returning void
Date: Tue,  7 Nov 2023 10:17:55 +0100	[thread overview]
Message-ID: <20231107091740.3924258-15-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231107091740.3924258-1-u.kleine-koenig@pengutronix.de>

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>
---
 .../video/fbdev/omap2/omapfb/displays/connector-analog-tv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
index 85fa58f48a81..c6786726a1af 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
@@ -221,7 +221,7 @@ static int tvc_probe(struct platform_device *pdev)
 	return r;
 }
 
-static int tvc_remove(struct platform_device *pdev)
+static void tvc_remove(struct platform_device *pdev)
 {
 	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -233,8 +233,6 @@ static int tvc_remove(struct platform_device *pdev)
 	tvc_disconnect(dssdev);
 
 	omap_dss_put_device(in);
-
-	return 0;
 }
 
 static const struct of_device_id tvc_of_match[] = {
@@ -247,7 +245,7 @@ MODULE_DEVICE_TABLE(of, tvc_of_match);
 
 static struct platform_driver tvc_connector_driver = {
 	.probe	= tvc_probe,
-	.remove	= tvc_remove,
+	.remove_new = tvc_remove,
 	.driver	= {
 		.name	= "connector-analog-tv",
 		.of_match_table = tvc_of_match,
-- 
2.42.0


WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Helge Deller <deller@gmx.de>
Cc: kernel@pengutronix.de, linux-omap@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 14/22] fb: omapfb/analog-tv: Convert to platform remove callback returning void
Date: Tue,  7 Nov 2023 10:17:55 +0100	[thread overview]
Message-ID: <20231107091740.3924258-15-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231107091740.3924258-1-u.kleine-koenig@pengutronix.de>

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>
---
 .../video/fbdev/omap2/omapfb/displays/connector-analog-tv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
index 85fa58f48a81..c6786726a1af 100644
--- a/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
+++ b/drivers/video/fbdev/omap2/omapfb/displays/connector-analog-tv.c
@@ -221,7 +221,7 @@ static int tvc_probe(struct platform_device *pdev)
 	return r;
 }
 
-static int tvc_remove(struct platform_device *pdev)
+static void tvc_remove(struct platform_device *pdev)
 {
 	struct panel_drv_data *ddata = platform_get_drvdata(pdev);
 	struct omap_dss_device *dssdev = &ddata->dssdev;
@@ -233,8 +233,6 @@ static int tvc_remove(struct platform_device *pdev)
 	tvc_disconnect(dssdev);
 
 	omap_dss_put_device(in);
-
-	return 0;
 }
 
 static const struct of_device_id tvc_of_match[] = {
@@ -247,7 +245,7 @@ MODULE_DEVICE_TABLE(of, tvc_of_match);
 
 static struct platform_driver tvc_connector_driver = {
 	.probe	= tvc_probe,
-	.remove	= tvc_remove,
+	.remove_new = tvc_remove,
 	.driver	= {
 		.name	= "connector-analog-tv",
 		.of_match_table = tvc_of_match,
-- 
2.42.0


  parent reply	other threads:[~2023-11-07  9:20 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  9:17 [PATCH 00/22] fb: handle remove callbacks in .exit.text and convert to .remove_new Uwe Kleine-König
2023-11-07  9:17 ` Uwe Kleine-König
2023-11-07  9:17 ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 01/22] fb: amifb: Stop using platform_driver_probe() Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-08 21:06   ` Geert Uytterhoeven
2023-11-08 21:06     ` Geert Uytterhoeven
2023-11-08 21:32     ` Helge Deller
2023-11-08 21:32       ` Helge Deller
2023-11-08 21:34       ` Geert Uytterhoeven
2023-11-08 21:34         ` Geert Uytterhoeven
2023-11-09 20:31         ` Helge Deller
2023-11-09 20:31           ` Helge Deller
2023-11-07  9:17 ` [PATCH 02/22] fb: atmel_lcdfb: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07 19:20   ` kernel test robot
2023-11-07 20:01   ` Uwe Kleine-König
2023-11-07 20:01     ` Uwe Kleine-König
2023-11-07 20:01     ` Uwe Kleine-König
2023-11-07 20:37     ` Helge Deller
2023-11-07 20:37       ` Helge Deller
2023-11-07 20:37       ` Helge Deller
2023-11-08 18:48   ` Nathan Chancellor
2023-11-08 18:48     ` Nathan Chancellor
2023-11-08 18:48     ` Nathan Chancellor
2023-11-08 20:27     ` Helge Deller
2023-11-08 20:27       ` Helge Deller
2023-11-08 20:27       ` Helge Deller
2023-11-08 21:00     ` Uwe Kleine-König
2023-11-08 21:00       ` Uwe Kleine-König
2023-11-08 21:24       ` Helge Deller
2023-11-08 21:24         ` Helge Deller
2023-11-08 21:24         ` Helge Deller
2023-11-08 21:52         ` Uwe Kleine-König
2023-11-08 21:52           ` Uwe Kleine-König
2023-11-08 21:52           ` Uwe Kleine-König
2023-11-08 21:57           ` Helge Deller
2023-11-08 21:57             ` Helge Deller
2023-11-08 21:57             ` Helge Deller
2023-11-09  6:24             ` Uwe Kleine-König
2023-11-09  6:24               ` Uwe Kleine-König
2023-11-09  9:55               ` Helge Deller
2023-11-09  9:55                 ` Helge Deller
2023-11-09 10:20                 ` Nicolas Ferre
2023-11-09 10:20                   ` Nicolas Ferre
2023-11-09 10:20                   ` Nicolas Ferre
2023-11-09 10:32                 ` Uwe Kleine-König
2023-11-09 10:32                   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 03/22] fb: omapfb/analog-tv: Don't put .remove() in .exit.text and drop suppress_bind_attrs Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 04/22] fb: omapfb/dpi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 05/22] fb: omapfb/dsi-cm: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 06/22] fb: omapfb/dvi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 07/22] fb: omapfb/hdmi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 08/22] fb: omapfb/opa362: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 09/22] fb: omapfb/sharp-ls037v7dw01: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 10/22] fb: omapfb/tfp410: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 11/22] fb: omapfb/tpd12s015: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 12/22] fb: amifb: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 13/22] fb: atmel_lcdfb: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` Uwe Kleine-König [this message]
2023-11-07  9:17   ` [PATCH 14/22] fb: omapfb/analog-tv: " Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 15/22] fb: omapfb/dpi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 16/22] fb: omapfb/dsi-cm: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 17/22] fb: omapfb/dvi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:17 ` [PATCH 18/22] fb: omapfb/hdmi: " Uwe Kleine-König
2023-11-07  9:17   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 19/22] fb: omapfb/opa362: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 20/22] fb: omapfb/sharp-ls037v7dw01: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 21/22] fb: omapfb/tfp410: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07  9:18 ` [PATCH 22/22] fb: omapfb/tpd12s015: " Uwe Kleine-König
2023-11-07  9:18   ` Uwe Kleine-König
2023-11-07 13:57 ` [PATCH 00/22] fb: handle remove callbacks in .exit.text and convert to .remove_new Helge Deller
2023-11-07 13:57   ` Helge Deller
2023-11-07 13:57   ` Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231107091740.3924258-15-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=deller@gmx.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.