From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Lee Jones <lee@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Jingoo Han <jingoohan1@gmail.com>, Helge Deller <deller@gmx.de> Cc: linux-fbdev@vger.kernel.org, kernel@pengutronix.de, dri-devel@lists.freedesktop.org Subject: [PATCH 01/13] backlight: aat2870_bl: Convert to platform remove callback returning void Date: Wed, 8 Mar 2023 08:39:33 +0100 [thread overview] Message-ID: <20230308073945.2336302-2-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230308073945.2336302-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 (mostly) ignored 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. 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/video/backlight/aat2870_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index 1cbb303e9c88..81fde3abb92c 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -178,7 +178,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) return ret; } -static int aat2870_bl_remove(struct platform_device *pdev) +static void aat2870_bl_remove(struct platform_device *pdev) { struct aat2870_bl_driver_data *aat2870_bl = platform_get_drvdata(pdev); struct backlight_device *bd = aat2870_bl->bd; @@ -186,8 +186,6 @@ static int aat2870_bl_remove(struct platform_device *pdev) bd->props.power = FB_BLANK_POWERDOWN; bd->props.brightness = 0; backlight_update_status(bd); - - return 0; } static struct platform_driver aat2870_bl_driver = { @@ -195,7 +193,7 @@ static struct platform_driver aat2870_bl_driver = { .name = "aat2870-backlight", }, .probe = aat2870_bl_probe, - .remove = aat2870_bl_remove, + .remove_new = aat2870_bl_remove, }; static int __init aat2870_bl_init(void) -- 2.39.1
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Lee Jones <lee@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Jingoo Han <jingoohan1@gmail.com>, Helge Deller <deller@gmx.de> Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/13] backlight: aat2870_bl: Convert to platform remove callback returning void Date: Wed, 8 Mar 2023 08:39:33 +0100 [thread overview] Message-ID: <20230308073945.2336302-2-u.kleine-koenig@pengutronix.de> (raw) In-Reply-To: <20230308073945.2336302-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 (mostly) ignored 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. 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/video/backlight/aat2870_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index 1cbb303e9c88..81fde3abb92c 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -178,7 +178,7 @@ static int aat2870_bl_probe(struct platform_device *pdev) return ret; } -static int aat2870_bl_remove(struct platform_device *pdev) +static void aat2870_bl_remove(struct platform_device *pdev) { struct aat2870_bl_driver_data *aat2870_bl = platform_get_drvdata(pdev); struct backlight_device *bd = aat2870_bl->bd; @@ -186,8 +186,6 @@ static int aat2870_bl_remove(struct platform_device *pdev) bd->props.power = FB_BLANK_POWERDOWN; bd->props.brightness = 0; backlight_update_status(bd); - - return 0; } static struct platform_driver aat2870_bl_driver = { @@ -195,7 +193,7 @@ static struct platform_driver aat2870_bl_driver = { .name = "aat2870-backlight", }, .probe = aat2870_bl_probe, - .remove = aat2870_bl_remove, + .remove_new = aat2870_bl_remove, }; static int __init aat2870_bl_init(void) -- 2.39.1
next prev parent reply other threads:[~2023-03-08 7:40 UTC|newest] Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-08 7:39 [PATCH 00/13] backlight: Convert to platform remove callback returning void Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König [this message] 2023-03-08 7:39 ` [PATCH 01/13] backlight: aat2870_bl: " Uwe Kleine-König 2023-03-16 13:47 ` Lee Jones 2023-03-16 13:47 ` Lee Jones 2023-03-08 7:39 ` [PATCH 02/13] backlight: adp5520_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-08 7:45 ` Hennerich, Michael 2023-03-08 7:45 ` Hennerich, Michael 2023-03-16 13:47 ` Lee Jones 2023-03-16 13:47 ` Lee Jones 2023-03-08 7:39 ` [PATCH 03/13] backlight: cr_bllcd: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:48 ` Lee Jones 2023-03-16 13:48 ` Lee Jones 2023-03-08 7:39 ` [PATCH 04/13] backlight: da9052_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-08 9:23 ` DLG Adam Ward 2023-03-08 9:23 ` DLG Adam Ward 2023-03-16 13:48 ` Lee Jones 2023-03-16 13:48 ` Lee Jones 2023-03-08 7:39 ` [PATCH 05/13] backlight: hp680_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:49 ` Lee Jones 2023-03-16 13:49 ` Lee Jones 2023-03-08 7:39 ` [PATCH 06/13] backlight: led_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:49 ` Lee Jones 2023-03-16 13:49 ` Lee Jones 2023-03-08 7:39 ` [PATCH 07/13] backlight: lm3533_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:50 ` Lee Jones 2023-03-16 13:50 ` Lee Jones 2023-03-08 7:39 ` [PATCH 08/13] backlight: lp8788_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:50 ` Lee Jones 2023-03-16 13:50 ` Lee Jones 2023-03-08 7:39 ` [PATCH 09/13] backlight: mt6370-backlight: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:50 ` Lee Jones 2023-03-16 13:50 ` Lee Jones 2023-03-16 13:50 ` Lee Jones 2023-03-08 7:39 ` [PATCH 10/13] backlight: pwm_bl: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:51 ` Lee Jones 2023-03-16 13:51 ` Lee Jones 2023-03-08 7:39 ` [PATCH 11/13] backlight: qcom-wled: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:51 ` Lee Jones 2023-03-16 13:51 ` Lee Jones 2023-03-08 7:39 ` [PATCH 12/13] backlight: rt4831-backlight: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:51 ` Lee Jones 2023-03-16 13:51 ` Lee Jones 2023-03-08 7:39 ` [PATCH 13/13] backlight: sky81452-backlight: " Uwe Kleine-König 2023-03-08 7:39 ` Uwe Kleine-König 2023-03-16 13:52 ` Lee Jones 2023-03-16 13:52 ` Lee Jones 2023-03-08 12:04 ` [PATCH 00/13] backlight: " Daniel Thompson 2023-03-08 12:04 ` Daniel Thompson 2023-03-08 12:04 ` Daniel Thompson
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=20230308073945.2336302-2-u.kleine-koenig@pengutronix.de \ --to=u.kleine-koenig@pengutronix.de \ --cc=daniel.thompson@linaro.org \ --cc=deller@gmx.de \ --cc=dri-devel@lists.freedesktop.org \ --cc=jingoohan1@gmail.com \ --cc=kernel@pengutronix.de \ --cc=lee@kernel.org \ --cc=linux-fbdev@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: linkBe 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.