From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net] fjes: Fix an error handling path in fjes_probe()
Date: Thu, 29 Dec 2022 17:34:22 +0100 [thread overview]
Message-ID: <437145bf-d925-e91e-affd-835d272c55a0@wanadoo.fr> (raw)
In-Reply-To: <Y6LZEVU7tKPzjHQ8@localhost.localdomain>
Le 21/12/2022 à 10:59, Michal Swiatkowski a écrit :
> On Tue, Dec 20, 2022 at 09:57:06PM +0100, Christophe JAILLET wrote:
>> A netif_napi_add() call is hidden in fjes_sw_init(). It should be undone
>> by a corresponding netif_napi_del() call in the error handling path of the
>> probe, as already done inthe remove function.
>>
>> Fixes: 265859309a76 ("fjes: NAPI polling function")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> drivers/net/fjes/fjes_main.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c
>> index 2513be6d4e11..01b4c9c6adbd 100644
>> --- a/drivers/net/fjes/fjes_main.c
>> +++ b/drivers/net/fjes/fjes_main.c
>> @@ -1370,7 +1370,7 @@ static int fjes_probe(struct platform_device *plat_dev)
>> adapter->txrx_wq = alloc_workqueue(DRV_NAME "/txrx", WQ_MEM_RECLAIM, 0);
>> if (unlikely(!adapter->txrx_wq)) {
>> err = -ENOMEM;
>> - goto err_free_netdev;
>> + goto err_del_napi;
>> }
>>
>> adapter->control_wq = alloc_workqueue(DRV_NAME "/control",
>> @@ -1431,6 +1431,8 @@ static int fjes_probe(struct platform_device *plat_dev)
>> destroy_workqueue(adapter->control_wq);
>> err_free_txrx_wq:
>> destroy_workqueue(adapter->txrx_wq);
>> +err_del_napi:
>> + netif_napi_del(&adapter->napi);
>> err_free_netdev:
>> free_netdev(netdev);
>> err_out:
>
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> I wonder if it won't be better to have fjes_sw_deinit() instead or
> change fjes_sw_init to only netif_napi_add(). You know, to avoid another
> bug here when someone add sth to the fjes_sw_deinit(). This is only
> suggestion, patch looks fine.
hi,
based on Jakub's comment [1], free_netdev() already cleans up NAPIs (see
[2]).
So would it make more sense to remove netif_napi_del() from the
.remove() function instead?
The call looks useless to me now.
CJ
[1]: https://lore.kernel.org/all/20221221174043.1191996a@kernel.org/
[2]: https://elixir.bootlin.com/linux/v6.2-rc1/source/net/core/dev.c#L10710
>
>> --
>> 2.34.1
>>
>
next prev parent reply other threads:[~2022-12-29 16:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-20 20:57 Christophe JAILLET
2022-12-21 9:59 ` Michal Swiatkowski
2022-12-29 16:34 ` Christophe JAILLET [this message]
2023-01-04 11:24 ` Michal Swiatkowski
2022-12-22 1:40 ` Jakub Kicinski
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=437145bf-d925-e91e-affd-835d272c55a0@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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
all inboxes | Powered by JetHome®