Skip to content

Commit c4c4fa5

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
backlight: led_bl: Convert to platform remove callback returning void
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> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230308073945.2336302-7-u.kleine-koenig@pengutronix.de
1 parent 7150f8c commit c4c4fa5

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/video/backlight/led_bl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int led_bl_probe(struct platform_device *pdev)
217217
return 0;
218218
}
219219

220-
static int led_bl_remove(struct platform_device *pdev)
220+
static void led_bl_remove(struct platform_device *pdev)
221221
{
222222
struct led_bl_data *priv = platform_get_drvdata(pdev);
223223
struct backlight_device *bl = priv->bl_dev;
@@ -228,8 +228,6 @@ static int led_bl_remove(struct platform_device *pdev)
228228
led_bl_power_off(priv);
229229
for (i = 0; i < priv->nb_leds; i++)
230230
led_sysfs_enable(priv->leds[i]);
231-
232-
return 0;
233231
}
234232

235233
static const struct of_device_id led_bl_of_match[] = {
@@ -245,7 +243,7 @@ static struct platform_driver led_bl_driver = {
245243
.of_match_table = of_match_ptr(led_bl_of_match),
246244
},
247245
.probe = led_bl_probe,
248-
.remove = led_bl_remove,
246+
.remove_new = led_bl_remove,
249247
};
250248

251249
module_platform_driver(led_bl_driver);

0 commit comments

Comments
 (0)