Skip to content

Commit 6879039

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
backlight: adp5520_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> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230308073945.2336302-3-u.kleine-koenig@pengutronix.de
1 parent 8b339ca commit 6879039

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/video/backlight/adp5520_bl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int adp5520_bl_probe(struct platform_device *pdev)
337337
return 0;
338338
}
339339

340-
static int adp5520_bl_remove(struct platform_device *pdev)
340+
static void adp5520_bl_remove(struct platform_device *pdev)
341341
{
342342
struct backlight_device *bl = platform_get_drvdata(pdev);
343343
struct adp5520_bl *data = bl_get_data(bl);
@@ -347,8 +347,6 @@ static int adp5520_bl_remove(struct platform_device *pdev)
347347
if (data->pdata->en_ambl_sens)
348348
sysfs_remove_group(&bl->dev.kobj,
349349
&adp5520_bl_attr_group);
350-
351-
return 0;
352350
}
353351

354352
#ifdef CONFIG_PM_SLEEP
@@ -377,7 +375,7 @@ static struct platform_driver adp5520_bl_driver = {
377375
.pm = &adp5520_bl_pm_ops,
378376
},
379377
.probe = adp5520_bl_probe,
380-
.remove = adp5520_bl_remove,
378+
.remove_new = adp5520_bl_remove,
381379
};
382380

383381
module_platform_driver(adp5520_bl_driver);

0 commit comments

Comments
 (0)