From: Fan Gong <gongfan1@huawei.com>
To: <markus.elfring@web.de>
Cc: <andrew+netdev@lunn.ch>, <davem@davemloft.net>,
<edumazet@google.com>, <gongfan1@huawei.com>,
<guoxin09@huawei.com>, <gur.stavi@huawei.com>, <horms@kernel.org>,
<kuba@kernel.org>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <luosifu@huawei.com>,
<luoyang82@h-partners.com>, <meny.yossefi@huawei.com>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<pavan.chebbi@broadcom.com>, <shenchenyang1@hisilicon.com>,
<shijing34@huawei.com>, <wulike1@huawei.com>,
<zhoushuai28@huawei.com>, <zhuyikai1@h-partners.com>
Subject: Re: [PATCH net-next v02 4/6] hinic3: Add mac filter ops
Date: Mon, 20 Oct 2025 09:29:44 +0800 [thread overview]
Message-ID: <20251020012947.2033-1-gongfan1@huawei.com> (raw)
In-Reply-To: <e8b52cf3-9f77-445c-8ba6-d8ac402841b7@web.de>
On 10/17/2025 7:51 PM, Markus Elfring wrote:
> …> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_filter.c
>> @@ -0,0 +1,413 @@
> …> +static int hinic3_mac_filter_sync(struct net_device *netdev,
>> + struct list_head *mac_filter_list, bool uc)
>> +{
> …
>> + hinic3_cleanup_filter_list(&tmp_add_list);> + hinic3_mac_filter_sync_hw(netdev, &tmp_del_list, &tmp_add_list);
>> +
>> + /* need to enter promiscuous/allmulti mode */
>> + err = -ENOMEM;
>> + goto err_out;
>> + }
>> +
>> + return add_count;
>> +
>> +err_out:
>> + return err;
>> +}
>
> Is there a need to move any resource cleanup actions behind a more appropriate label?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.17#n532
>
>
> Regards,
> Markus
Hi, Markus. Thanks for your comment.
Your suggestion is great. In "hinic3_mac_filter_sync", there are two places in
the code that return error values.
Actually the error handling code you quoted should be refined as a new function
because its error handling is special and cannot be normalized to function error
path.
> + if (err) {
> + hinic3_undo_del_filter_entries(mac_filter_list, &tmp_del_list);
> + hinic3_undo_add_filter_entries(mac_filter_list, &tmp_add_list);
> + netdev_err(netdev, "Failed to clone mac_filter_entry\n");
> +
> + hinic3_cleanup_filter_list(&tmp_del_list);
> + hinic3_cleanup_filter_list(&tmp_add_list);
> + goto err_out;
> + }
And anther place(only cleanup del_list & add_list) should be moved behind a
error label in function error path according to linux doc.
next prev parent reply other threads:[~2025-10-20 1:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 8:30 [PATCH net-next v02 0/6] net: hinic3: PF initialization Fan Gong
2025-10-17 8:30 ` [PATCH net-next v02 1/6] hinic3: Add PF framework Fan Gong
2025-10-21 9:16 ` Paolo Abeni
2025-10-17 8:30 ` [PATCH net-next v02 2/6] hinic3: Add PF management interfaces Fan Gong
2025-10-21 9:25 ` Paolo Abeni
2025-10-17 8:30 ` [PATCH net-next v02 3/6] hinic3: Add NIC configuration ops Fan Gong
2025-10-21 10:02 ` Paolo Abeni
2025-10-17 8:30 ` [PATCH net-next v02 4/6] hinic3: Add mac filter ops Fan Gong
2025-10-17 11:51 ` Markus Elfring
2025-10-20 1:29 ` Fan Gong [this message]
2025-10-21 10:16 ` Paolo Abeni
2025-10-17 8:30 ` [PATCH net-next v02 5/6] hinic3: Add netdev register interfaces Fan Gong
2025-10-17 8:30 ` [PATCH net-next v02 6/6] hinic3: Fix netif_queue_set_napi queue_index parameter passing error Fan Gong
2025-10-21 10:22 ` Paolo Abeni
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=20251020012947.2033-1-gongfan1@huawei.com \
--to=gongfan1@huawei.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guoxin09@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luosifu@huawei.com \
--cc=luoyang82@h-partners.com \
--cc=markus.elfring@web.de \
--cc=meny.yossefi@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=shenchenyang1@hisilicon.com \
--cc=shijing34@huawei.com \
--cc=wulike1@huawei.com \
--cc=zhoushuai28@huawei.com \
--cc=zhuyikai1@h-partners.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