Skip to content

Commit cba7dfe

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
backlight: lm3533_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-8-u.kleine-koenig@pengutronix.de
1 parent c4c4fa5 commit cba7dfe

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/video/backlight/lm3533_bl.c

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

340-
static int lm3533_bl_remove(struct platform_device *pdev)
340+
static void lm3533_bl_remove(struct platform_device *pdev)
341341
{
342342
struct lm3533_bl *bl = platform_get_drvdata(pdev);
343343
struct backlight_device *bd = bl->bd;
@@ -349,8 +349,6 @@ static int lm3533_bl_remove(struct platform_device *pdev)
349349

350350
lm3533_ctrlbank_disable(&bl->cb);
351351
sysfs_remove_group(&bd->dev.kobj, &lm3533_bl_attribute_group);
352-
353-
return 0;
354352
}
355353

356354
#ifdef CONFIG_PM_SLEEP
@@ -390,7 +388,7 @@ static struct platform_driver lm3533_bl_driver = {
390388
.pm = &lm3533_bl_pm_ops,
391389
},
392390
.probe = lm3533_bl_probe,
393-
.remove = lm3533_bl_remove,
391+
.remove_new = lm3533_bl_remove,
394392
.shutdown = lm3533_bl_shutdown,
395393
};
396394
module_platform_driver(lm3533_bl_driver);

0 commit comments

Comments
 (0)