Skip to content

Commit 74a81c4

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
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>
1 parent 3d82dca commit 74a81c4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/char/xilinx_hwicap/xilinx_hwicap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ static int hwicap_drv_probe(struct platform_device *pdev)
804804
&buffer_icap_config, regs);
805805
}
806806

807-
static int hwicap_drv_remove(struct platform_device *pdev)
807+
static void hwicap_drv_remove(struct platform_device *pdev)
808808
{
809809
struct device *dev = &pdev->dev;
810810
struct hwicap_drvdata *drvdata;
@@ -820,8 +820,6 @@ static int hwicap_drv_remove(struct platform_device *pdev)
820820
mutex_lock(&icap_sem);
821821
probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
822822
mutex_unlock(&icap_sem);
823-
824-
return 0;
825823
}
826824

827825
#ifdef CONFIG_OF
@@ -838,7 +836,7 @@ MODULE_DEVICE_TABLE(of, hwicap_of_match);
838836

839837
static struct platform_driver hwicap_platform_driver = {
840838
.probe = hwicap_drv_probe,
841-
.remove = hwicap_drv_remove,
839+
.remove_new = hwicap_drv_remove,
842840
.driver = {
843841
.name = DRIVER_NAME,
844842
.of_match_table = hwicap_of_match,

0 commit comments

Comments
 (0)