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

misc: xilinx_tmr_inject: 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: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/198112757eac0fc004677a4757ce48ae7c7194ab.1708508896.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
37efe116 2743e96f

+2 -3
+2 -3
drivers/misc/xilinx_tmr_inject.c
··· 143 143 return 0; 144 144 } 145 145 146 - static int xtmr_inject_remove(struct platform_device *pdev) 146 + static void xtmr_inject_remove(struct platform_device *pdev) 147 147 { 148 148 debugfs_remove_recursive(dbgfs_root); 149 149 dbgfs_root = NULL; 150 - return 0; 151 150 } 152 151 153 152 static const struct of_device_id xtmr_inject_of_match[] = { ··· 163 164 .of_match_table = xtmr_inject_of_match, 164 165 }, 165 166 .probe = xtmr_inject_probe, 166 - .remove = xtmr_inject_remove, 167 + .remove_new = xtmr_inject_remove, 167 168 }; 168 169 module_platform_driver(xtmr_inject_driver); 169 170 MODULE_AUTHOR("Advanced Micro Devices, Inc");