From 74a81c4854a8cda61efabcb18ea1ba5b1ae7f768 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Mon, 5 Jun 2023 11:20:47 +0200 Subject: char: xilinx_hwicap: Convert to platform remove callback returning void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: Michal Simek Message-ID: <20230605092047.50472-3-u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman --- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/char') 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, -- cgit v1.2.3