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

pcmcia: sa1100: 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>
Link: https://lore.kernel.org/r/6473afe67fc5c320a8184d0871a8561f7685e265.1702051073.git.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
c1991d49 e5b25d20

+3 -5
+3 -5
drivers/pcmcia/sa1100_generic.c
··· 158 158 return sa11xx_drv_pcmcia_add_one(skt); 159 159 } 160 160 161 - static int sa11x0_drv_pcmcia_remove(struct platform_device *dev) 161 + static void sa11x0_drv_pcmcia_remove(struct platform_device *dev) 162 162 { 163 163 struct soc_pcmcia_socket *skt; 164 164 165 165 if (dev->id == -1) { 166 166 sa11x0_drv_pcmcia_legacy_remove(dev); 167 - return 0; 167 + return; 168 168 } 169 169 170 170 skt = platform_get_drvdata(dev); 171 171 172 172 soc_pcmcia_remove_one(skt); 173 - 174 - return 0; 175 173 } 176 174 177 175 static struct platform_driver sa11x0_pcmcia_driver = { ··· 177 179 .name = "sa11x0-pcmcia", 178 180 }, 179 181 .probe = sa11x0_drv_pcmcia_probe, 180 - .remove = sa11x0_drv_pcmcia_remove, 182 + .remove_new = sa11x0_drv_pcmcia_remove, 181 183 }; 182 184 183 185 /* sa11x0_pcmcia_init()