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

phy: xilinx: 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: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/57a3338a1cec683ac84d48e00dbf197e15ee5481.1709886922.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Uwe Kleine-König and committed by
Vinod Koul
7dcb8668 9b6bfad9

+2 -4
+2 -4
drivers/phy/xilinx/phy-zynqmp.c
··· 995 995 return 0; 996 996 } 997 997 998 - static int xpsgtr_remove(struct platform_device *pdev) 998 + static void xpsgtr_remove(struct platform_device *pdev) 999 999 { 1000 1000 struct xpsgtr_dev *gtr_dev = platform_get_drvdata(pdev); 1001 1001 1002 1002 pm_runtime_disable(gtr_dev->dev); 1003 1003 pm_runtime_put_noidle(gtr_dev->dev); 1004 1004 pm_runtime_set_suspended(gtr_dev->dev); 1005 - 1006 - return 0; 1007 1005 } 1008 1006 1009 1007 static const struct of_device_id xpsgtr_of_match[] = { ··· 1013 1015 1014 1016 static struct platform_driver xpsgtr_driver = { 1015 1017 .probe = xpsgtr_probe, 1016 - .remove = xpsgtr_remove, 1018 + .remove_new = xpsgtr_remove, 1017 1019 .driver = { 1018 1020 .name = "xilinx-psgtr", 1019 1021 .of_match_table = xpsgtr_of_match,