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

Configure Feed

Select the types of activity you want to include in your feed.

cdx: 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>
Acked-by: Nipun Gupta <nipun.gupta@amd.com>
Link: https://lore.kernel.org/r/5d40f57e978bcce003133306712ec96439e93595.1709886922.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
4b9f8621 3f58b0eb

+2 -4
+2 -4
drivers/cdx/controller/cdx_controller.c
··· 222 222 return ret; 223 223 } 224 224 225 - static int xlnx_cdx_remove(struct platform_device *pdev) 225 + static void xlnx_cdx_remove(struct platform_device *pdev) 226 226 { 227 227 struct cdx_controller *cdx = platform_get_drvdata(pdev); 228 228 struct cdx_mcdi *cdx_mcdi = cdx->priv; ··· 234 234 235 235 cdx_mcdi_finish(cdx_mcdi); 236 236 kfree(cdx_mcdi); 237 - 238 - return 0; 239 237 } 240 238 241 239 static const struct of_device_id cdx_match_table[] = { ··· 250 252 .of_match_table = cdx_match_table, 251 253 }, 252 254 .probe = xlnx_cdx_probe, 253 - .remove = xlnx_cdx_remove, 255 + .remove_new = xlnx_cdx_remove, 254 256 }; 255 257 256 258 static int __init cdx_controller_init(void)