mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
sh: push-switch: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). 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: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Link: https://lore.kernel.org/r/20240306211947.97103-2-u.kleine-koenig@pengutronix.de Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
This commit is contained in:
parent
bbfd365292
commit
5019cd6114
@ -91,7 +91,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int switch_drv_remove(struct platform_device *pdev)
|
||||
static void switch_drv_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct push_switch *psw = platform_get_drvdata(pdev);
|
||||
struct push_switch_platform_info *psw_info = pdev->dev.platform_data;
|
||||
@ -106,13 +106,11 @@ static int switch_drv_remove(struct platform_device *pdev)
|
||||
free_irq(irq, pdev);
|
||||
|
||||
kfree(psw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver switch_driver = {
|
||||
.probe = switch_drv_probe,
|
||||
.remove = switch_drv_remove,
|
||||
.remove_new = switch_drv_remove,
|
||||
.driver = {
|
||||
.name = DRV_NAME,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user