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

pwm: img: 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>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
f365a946 1b6d6ce5

+2 -4
+2 -4
drivers/pwm/pwm-img.c
··· 343 343 return ret; 344 344 } 345 345 346 - static int img_pwm_remove(struct platform_device *pdev) 346 + static void img_pwm_remove(struct platform_device *pdev) 347 347 { 348 348 struct img_pwm_chip *imgchip = platform_get_drvdata(pdev); 349 349 ··· 352 352 img_pwm_runtime_suspend(&pdev->dev); 353 353 354 354 pwmchip_remove(&imgchip->chip); 355 - 356 - return 0; 357 355 } 358 356 359 357 #ifdef CONFIG_PM_SLEEP ··· 421 423 .of_match_table = img_pwm_of_match, 422 424 }, 423 425 .probe = img_pwm_probe, 424 - .remove = img_pwm_remove, 426 + .remove_new = img_pwm_remove, 425 427 }; 426 428 module_platform_driver(img_pwm_driver); 427 429