[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM5PR04MB3139844BED84F444D279790F8853A@AM5PR04MB3139.eurprd04.prod.outlook.com>
Date: Wed, 7 Jun 2023 06:48:20 +0000
From: Wei Fang <wei.fang@....com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Marc
Kleine-Budde <mkl@...gutronix.de>, Damien Le Moal
<damien.lemoal@...nsource.wdc.com>, Michael Ellerman <mpe@...erman.id.au>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Rob Herring
<robh@...nel.org>
CC: Shenwei Wang <shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>,
dl-linux-imx <linux-imx@....com>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, "kernel@...gutronix.de" <kernel@...gutronix.de>,
Michal Kubiak <michal.kubiak@...el.com>
Subject: RE: [PATCH net-next v2 3/8] net: fec: Convert to platform remove
callback returning void
> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> Sent: 2023年6月7日 0:28
> To: Wei Fang <wei.fang@....com>; David S. Miller <davem@...emloft.net>;
> Eric Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>;
> Paolo Abeni <pabeni@...hat.com>; Marc Kleine-Budde
> <mkl@...gutronix.de>; Damien Le Moal
> <damien.lemoal@...nsource.wdc.com>; Michael Ellerman
> <mpe@...erman.id.au>; Andy Shevchenko
> <andriy.shevchenko@...ux.intel.com>; Rob Herring <robh@...nel.org>
> Cc: Shenwei Wang <shenwei.wang@....com>; Clark Wang
> <xiaoning.wang@....com>; dl-linux-imx <linux-imx@....com>;
> netdev@...r.kernel.org; kernel@...gutronix.de; Michal Kubiak
> <michal.kubiak@...el.com>
> Subject: [PATCH net-next v2 3/8] net: fec: 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 (mostly) ignored
> 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.
>
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
>
> Reviewed-by: Michal Kubiak <michal.kubiak@...el.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 5 ++---
> drivers/net/ethernet/freescale/fec_mpc52xx.c | 6 ++----
> drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 6 ++----
> 3 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 632bb4d589d7..f2b333b3f8c5 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -4458,7 +4458,7 @@ fec_probe(struct platform_device *pdev)
> return ret;
> }
>
> -static int
> +static void
> fec_drv_remove(struct platform_device *pdev)
> {
> struct net_device *ndev = platform_get_drvdata(pdev);
> @@ -4494,7 +4494,6 @@ fec_drv_remove(struct platform_device *pdev)
> pm_runtime_disable(&pdev->dev);
>
> free_netdev(ndev);
> - return 0;
> }
>
> static int __maybe_unused fec_suspend(struct device *dev)
> @@ -4650,7 +4649,7 @@ static struct platform_driver fec_driver = {
> },
> .id_table = fec_devtype,
> .probe = fec_probe,
> - .remove = fec_drv_remove,
> + .remove_new = fec_drv_remove,
> };
>
> module_platform_driver(fec_driver);
Thank you!
Reviewed-by: Wei Fang <wei.fang@....com>
Powered by blists - more mailing lists