Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

backlight: rt4831-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-13-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Lee Jones
20c111d2 ea379bc8

+2 -4
+2 -4
drivers/video/backlight/rt4831-backlight.c
··· 203 203 return 0; 204 204 } 205 205 206 - static int rt4831_bl_remove(struct platform_device *pdev) 206 + static void rt4831_bl_remove(struct platform_device *pdev) 207 207 { 208 208 struct rt4831_priv *priv = platform_get_drvdata(pdev); 209 209 struct backlight_device *bl_dev = priv->bl; 210 210 211 211 bl_dev->props.brightness = 0; 212 212 backlight_update_status(priv->bl); 213 - 214 - return 0; 215 213 } 216 214 217 215 static const struct of_device_id __maybe_unused rt4831_bl_of_match[] = { ··· 224 226 .of_match_table = rt4831_bl_of_match, 225 227 }, 226 228 .probe = rt4831_bl_probe, 227 - .remove = rt4831_bl_remove, 229 + .remove_new = rt4831_bl_remove, 228 230 }; 229 231 module_platform_driver(rt4831_bl_driver); 230 232