Re: [PATCH] net: bgmac: use devm for register_netdev
From: Rosen Penev
Date: Sat Oct 05 2024 - 22:08:52 EST
On Sat, Oct 5, 2024 at 6:39 PM Rosen Penev <rosenp@xxxxxxxxx> wrote:
>
> Removes need to unregister in _remove.
>
> Tested on ASUS RT-N16. No change in behavior.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
yikes. I wanted this in net-next.
> ---
> drivers/net/ethernet/broadcom/bgmac.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
> index 6ffdc4229407..2599ffe46e27 100644
> --- a/drivers/net/ethernet/broadcom/bgmac.c
> +++ b/drivers/net/ethernet/broadcom/bgmac.c
> @@ -1546,7 +1546,7 @@ int bgmac_enet_probe(struct bgmac *bgmac)
>
> bgmac->in_init = false;
>
> - err = register_netdev(bgmac->net_dev);
> + err = devm_register_netdev(bgmac->dev, bgmac->net_dev);
> if (err) {
> dev_err(bgmac->dev, "Cannot register net device\n");
> goto err_phy_disconnect;
> @@ -1568,7 +1568,6 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
>
> void bgmac_enet_remove(struct bgmac *bgmac)
> {
> - unregister_netdev(bgmac->net_dev);
> phy_disconnect(bgmac->net_dev->phydev);
> netif_napi_del(&bgmac->napi);
> bgmac_dma_free(bgmac);
> --
> 2.46.2
>