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

mcb: lpc: 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: Johannes Thumshirn <jth@kernel.org>
Link: https://lore.kernel.org/r/cd04e21a7e2646bfe44b2304eea2b3fd0ee84018.1714379722.git.jth@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
a2c72ed7 0b689683

+2 -4
+2 -4
drivers/mcb/mcb-lpc.c
··· 97 97 return ret; 98 98 } 99 99 100 - static int mcb_lpc_remove(struct platform_device *pdev) 100 + static void mcb_lpc_remove(struct platform_device *pdev) 101 101 { 102 102 struct priv *priv = platform_get_drvdata(pdev); 103 103 104 104 mcb_release_bus(priv->bus); 105 - 106 - return 0; 107 105 } 108 106 109 107 static struct platform_device *mcb_lpc_pdev; ··· 138 140 .name = "mcb-lpc", 139 141 }, 140 142 .probe = mcb_lpc_probe, 141 - .remove = mcb_lpc_remove, 143 + .remove_new = mcb_lpc_remove, 142 144 }; 143 145 144 146 static const struct dmi_system_id mcb_lpc_dmi_table[] = {