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

mtd: hyperbus: rpc-if: 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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Link: https://lore.kernel.org/linux-mtd/20231008200143.196369-11-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Miquel Raynal
baaa90c1 59bd5676

+2 -4
+2 -4
drivers/mtd/hyperbus/rpc-if.c
··· 154 154 return error; 155 155 } 156 156 157 - static int rpcif_hb_remove(struct platform_device *pdev) 157 + static void rpcif_hb_remove(struct platform_device *pdev) 158 158 { 159 159 struct rpcif_hyperbus *hyperbus = platform_get_drvdata(pdev); 160 160 161 161 hyperbus_unregister_device(&hyperbus->hbdev); 162 162 163 163 pm_runtime_disable(hyperbus->rpc.dev); 164 - 165 - return 0; 166 164 } 167 165 168 166 static struct platform_driver rpcif_platform_driver = { 169 167 .probe = rpcif_hb_probe, 170 - .remove = rpcif_hb_remove, 168 + .remove_new = rpcif_hb_remove, 171 169 .driver = { 172 170 .name = "rpc-if-hyperflash", 173 171 },