Skip to content

Commit 0816e1d

Browse files
Uwe Kleine-Königmarckleinebudde
authored andcommitted
can: 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() 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> Link: https://lore.kernel.org/r/20230512212725.143824-20-u.kleine-koenig@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 9587b93 commit 0816e1d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/can/xilinx_can.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,20 +1898,18 @@ static int xcan_probe(struct platform_device *pdev)
18981898
* This function frees all the resources allocated to the device.
18991899
* Return: 0 always
19001900
*/
1901-
static int xcan_remove(struct platform_device *pdev)
1901+
static void xcan_remove(struct platform_device *pdev)
19021902
{
19031903
struct net_device *ndev = platform_get_drvdata(pdev);
19041904

19051905
unregister_candev(ndev);
19061906
pm_runtime_disable(&pdev->dev);
19071907
free_candev(ndev);
1908-
1909-
return 0;
19101908
}
19111909

19121910
static struct platform_driver xcan_driver = {
19131911
.probe = xcan_probe,
1914-
.remove = xcan_remove,
1912+
.remove_new = xcan_remove,
19151913
.driver = {
19161914
.name = DRIVER_NAME,
19171915
.pm = &xcan_dev_pm_ops,

0 commit comments

Comments
 (0)