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

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

authored by

Uwe Kleine-König and committed by
Lee Jones
519e5cc5 1c708d34

+2 -4
+2 -4
drivers/video/backlight/mt6370-backlight.c
··· 318 318 return 0; 319 319 } 320 320 321 - static int mt6370_bl_remove(struct platform_device *pdev) 321 + static void mt6370_bl_remove(struct platform_device *pdev) 322 322 { 323 323 struct mt6370_priv *priv = platform_get_drvdata(pdev); 324 324 struct backlight_device *bl_dev = priv->bl; 325 325 326 326 bl_dev->props.brightness = 0; 327 327 backlight_update_status(priv->bl); 328 - 329 - return 0; 330 328 } 331 329 332 330 static const struct of_device_id mt6370_bl_of_match[] = { ··· 340 342 .of_match_table = mt6370_bl_of_match, 341 343 }, 342 344 .probe = mt6370_bl_probe, 343 - .remove = mt6370_bl_remove, 345 + .remove_new = mt6370_bl_remove, 344 346 }; 345 347 module_platform_driver(mt6370_bl_driver); 346 348