From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Support Opensource <support.opensource@diasemi.com>, 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 04/13] backlight: da9052_bl: Convert to platform remove callback returning void Date: Wed, 8 Mar 2023 08:39:36 +0100 [thread overview] Message-ID: <20230308073945.2336302-5-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/da9052_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index 882359dd288c..1cdc8543310b 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -135,7 +135,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) return da9052_adjust_wled_brightness(wleds); } -static int da9052_backlight_remove(struct platform_device *pdev) +static void da9052_backlight_remove(struct platform_device *pdev) { struct backlight_device *bl = platform_get_drvdata(pdev); struct da9052_bl *wleds = bl_get_data(bl); @@ -143,8 +143,6 @@ static int da9052_backlight_remove(struct platform_device *pdev) wleds->brightness = 0; wleds->state = DA9052_WLEDS_OFF; da9052_adjust_wled_brightness(wleds); - - return 0; } static const struct platform_device_id da9052_wled_ids[] = { @@ -166,7 +164,7 @@ MODULE_DEVICE_TABLE(platform, da9052_wled_ids); static struct platform_driver da9052_wled_driver = { .probe = da9052_backlight_probe, - .remove = da9052_backlight_remove, + .remove_new = da9052_backlight_remove, .id_table = da9052_wled_ids, .driver = { .name = "da9052-wled", -- 2.39.1
WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> To: Support Opensource <support.opensource@diasemi.com>, 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 04/13] backlight: da9052_bl: Convert to platform remove callback returning void Date: Wed, 8 Mar 2023 08:39:36 +0100 [thread overview] Message-ID: <20230308073945.2336302-5-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/da9052_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c index 882359dd288c..1cdc8543310b 100644 --- a/drivers/video/backlight/da9052_bl.c +++ b/drivers/video/backlight/da9052_bl.c @@ -135,7 +135,7 @@ static int da9052_backlight_probe(struct platform_device *pdev) return da9052_adjust_wled_brightness(wleds); } -static int da9052_backlight_remove(struct platform_device *pdev) +static void da9052_backlight_remove(struct platform_device *pdev) { struct backlight_device *bl = platform_get_drvdata(pdev); struct da9052_bl *wleds = bl_get_data(bl); @@ -143,8 +143,6 @@ static int da9052_backlight_remove(struct platform_device *pdev) wleds->brightness = 0; wleds->state = DA9052_WLEDS_OFF; da9052_adjust_wled_brightness(wleds); - - return 0; } static const struct platform_device_id da9052_wled_ids[] = { @@ -166,7 +164,7 @@ MODULE_DEVICE_TABLE(platform, da9052_wled_ids); static struct platform_driver da9052_wled_driver = { .probe = da9052_backlight_probe, - .remove = da9052_backlight_remove, + .remove_new = da9052_backlight_remove, .id_table = da9052_wled_ids, .driver = { .name = "da9052-wled", -- 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 ` [PATCH 01/13] backlight: aat2870_bl: " Uwe Kleine-König 2023-03-08 7:39 ` 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 ` Uwe Kleine-König [this message] 2023-03-08 7:39 ` [PATCH 04/13] backlight: da9052_bl: " 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-5-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 \ --cc=support.opensource@diasemi.com \ /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.