[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240329085633.2cfae5e5@kernel.org>
Date: Fri, 29 Mar 2024 08:56:33 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: aleksander.lobakin@...el.com, davem@...emloft.net, pabeni@...hat.com,
edumazet@...gle.com, Taras Chornyi <taras.chornyi@...ision.eu>,
quic_jjohnson@...cinc.com, kvalo@...nel.org, leon@...nel.org,
dennis.dalessandro@...nelisnetworks.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 2/5] net: marvell: prestera: allocate dummy
net_device dynamically
On Thu, 28 Mar 2024 16:52:02 -0700 Breno Leitao wrote:
> - init_dummy_netdev(&sdma->napi_dev);
> + sdma->napi_dev = alloc_netdev_dummy(0);
> + if (!sdma->napi_dev) {
> + dev_err(dev, "not able to initialize dummy device\n");
> + goto err_alloc_dummy;
> + }
> +
>
duplicated empty line here
> - netif_napi_add(&sdma->napi_dev, &sdma->rx_napi, prestera_sdma_rx_poll);
> + netif_napi_add(sdma->napi_dev, &sdma->rx_napi, prestera_sdma_rx_poll);
> napi_enable(&sdma->rx_napi);
>
> return 0;
>
> +err_alloc_dummy:
> + prestera_hw_event_handler_unregister(sw, PRESTERA_EVENT_TYPE_RXTX,
> + prestera_rxtx_handle_event);
> err_evt_register:
> err_tx_init:
> prestera_sdma_tx_fini(sdma);
> @@ -682,6 +690,7 @@ static void prestera_sdma_switch_fini(struct prestera_switch *sw)
> prestera_sdma_tx_fini(sdma);
> prestera_sdma_rx_fini(sdma);
> dma_pool_destroy(sdma->desc_pool);
> + kfree(sdma->napi_dev);
Why kfree()? Let's use free_netdev() consistently, in case one day
we have to undo something alloc_netdev_dummy() has done.
Powered by blists - more mailing lists