diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2023-06-05 11:20:47 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-06-15 13:43:21 +0200 |
commit | 74a81c4854a8cda61efabcb18ea1ba5b1ae7f768 (patch) | |
tree | da96d3356fdfc1d261ea70a324de02bbb1662aa0 /drivers/char | |
parent | 3d82dca0f27ac5a0bfbbce439bba5c6452f3b7da (diff) | |
download | lwn-74a81c4854a8cda61efabcb18ea1ba5b1ae7f768.tar.gz lwn-74a81c4854a8cda61efabcb18ea1ba5b1ae7f768.zip |
char: xilinx_hwicap: 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() is 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: Michal Simek <michal.simek@amd.com>
Message-ID: <20230605092047.50472-3-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/xilinx_hwicap/xilinx_hwicap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 87ece300b2ca..00e5cf42babc 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -804,7 +804,7 @@ static int hwicap_drv_probe(struct platform_device *pdev) &buffer_icap_config, regs); } -static int hwicap_drv_remove(struct platform_device *pdev) +static void hwicap_drv_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct hwicap_drvdata *drvdata; @@ -820,8 +820,6 @@ static int hwicap_drv_remove(struct platform_device *pdev) mutex_lock(&icap_sem); probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0; mutex_unlock(&icap_sem); - - return 0; } #ifdef CONFIG_OF @@ -838,7 +836,7 @@ MODULE_DEVICE_TABLE(of, hwicap_of_match); static struct platform_driver hwicap_platform_driver = { .probe = hwicap_drv_probe, - .remove = hwicap_drv_remove, + .remove_new = hwicap_drv_remove, .driver = { .name = DRIVER_NAME, .of_match_table = hwicap_of_match, |