netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Breno Leitao <leitao@debian.org>
Cc: aleksander.lobakin@intel.com, davem@davemloft.net,
	pabeni@redhat.com, edumazet@google.com,
	Taras Chornyi <taras.chornyi@plvision.eu>,
	quic_jjohnson@quicinc.com, kvalo@kernel.org, leon@kernel.org,
	dennis.dalessandro@cornelisnetworks.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/5] net: marvell: prestera: allocate dummy net_device dynamically
Date: Fri, 29 Mar 2024 08:56:33 -0700	[thread overview]
Message-ID: <20240329085633.2cfae5e5@kernel.org> (raw)
In-Reply-To: <20240328235214.4079063-3-leitao@debian.org>

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.

  reply	other threads:[~2024-03-29 15:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 23:52 [PATCH net-next v2 0/5] allocate dummy device dynamically Breno Leitao
2024-03-28 23:52 ` [PATCH net-next v2 1/5] net: create a dummy net_device allocator Breno Leitao
2024-03-28 23:52 ` [PATCH net-next v2 2/5] net: marvell: prestera: allocate dummy net_device dynamically Breno Leitao
2024-03-29 15:56   ` Jakub Kicinski [this message]
2024-03-29 17:21     ` Breno Leitao
2024-03-31  8:54   ` Simon Horman
2024-04-03 14:27     ` Breno Leitao
2024-03-28 23:52 ` [PATCH net-next v2 3/5] net: mediatek: mtk_eth_sock: " Breno Leitao
2024-03-28 23:52 ` [PATCH net-next v2 4/5] net: ipa: " Breno Leitao
2024-04-01 13:56   ` Alex Elder
2024-04-03 13:38     ` Breno Leitao
2024-03-28 23:52 ` [PATCH net-next v2 5/5] net: ibm/emac: " Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240329085633.2cfae5e5@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=edumazet@google.com \
    --cc=kvalo@kernel.org \
    --cc=leitao@debian.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quic_jjohnson@quicinc.com \
    --cc=taras.chornyi@plvision.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).