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

staging: nvec_ps2: 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>
Link: https://lore.kernel.org/r/20230403154014.2564054-22-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
cedff4e3 f1e870c4

+2 -4
+2 -4
drivers/staging/nvec/nvec_ps2.c
··· 125 125 return 0; 126 126 } 127 127 128 - static int nvec_mouse_remove(struct platform_device *pdev) 128 + static void nvec_mouse_remove(struct platform_device *pdev) 129 129 { 130 130 struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); 131 131 ··· 133 133 ps2_stopstreaming(ps2_dev.ser_dev); 134 134 nvec_unregister_notifier(nvec, &ps2_dev.notifier); 135 135 serio_unregister_port(ps2_dev.ser_dev); 136 - 137 - return 0; 138 136 } 139 137 140 138 #ifdef CONFIG_PM_SLEEP ··· 164 166 165 167 static struct platform_driver nvec_mouse_driver = { 166 168 .probe = nvec_mouse_probe, 167 - .remove = nvec_mouse_remove, 169 + .remove_new = nvec_mouse_remove, 168 170 .driver = { 169 171 .name = "nvec-mouse", 170 172 .pm = &nvec_mouse_pm_ops,