Skip to content

Commit 541ec23

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
backlight: sky81452-backlight: 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-14-u.kleine-koenig@pengutronix.de
1 parent 20c111d commit 541ec23

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/video/backlight/sky81452-backlight.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int sky81452_bl_probe(struct platform_device *pdev)
311311
return ret;
312312
}
313313

314-
static int sky81452_bl_remove(struct platform_device *pdev)
314+
static void sky81452_bl_remove(struct platform_device *pdev)
315315
{
316316
const struct sky81452_bl_platform_data *pdata =
317317
dev_get_platdata(&pdev->dev);
@@ -325,8 +325,6 @@ static int sky81452_bl_remove(struct platform_device *pdev)
325325

326326
if (pdata->gpiod_enable)
327327
gpiod_set_value_cansleep(pdata->gpiod_enable, 0);
328-
329-
return 0;
330328
}
331329

332330
#ifdef CONFIG_OF
@@ -343,7 +341,7 @@ static struct platform_driver sky81452_bl_driver = {
343341
.of_match_table = of_match_ptr(sky81452_bl_of_match),
344342
},
345343
.probe = sky81452_bl_probe,
346-
.remove = sky81452_bl_remove,
344+
.remove_new = sky81452_bl_remove,
347345
};
348346

349347
module_platform_driver(sky81452_bl_driver);

0 commit comments

Comments
 (0)