According to comment of patch 03, check codes that were merged and
remove redundant defensive codes.
Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com>
Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com>
Signed-off-by: Fan Gong <gongfan1@huawei.com>
---
drivers/net/ethernet/huawei/hinic3/hinic3_tx.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
index 4e361c9bd043..6d3dc930ca97 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
@@ -44,16 +44,10 @@ static void hinic3_txq_stats_init(struct hinic3_txq *txq)
int hinic3_alloc_txqs(struct net_device *netdev)
{
struct hinic3_nic_dev *nic_dev = netdev_priv(netdev);
- struct hinic3_hwdev *hwdev = nic_dev->hwdev;
u16 q_id, num_txqs = nic_dev->max_qps;
struct pci_dev *pdev = nic_dev->pdev;
struct hinic3_txq *txq;
- if (!num_txqs) {
- dev_err(hwdev->dev, "Cannot allocate zero size txqs\n");
- return -EINVAL;
- }
-
nic_dev->txqs = kcalloc(num_txqs, sizeof(*nic_dev->txqs), GFP_KERNEL);
if (!nic_dev->txqs)
return -ENOMEM;
--
2.43.0
On Mon, Jan 26, 2026 at 09:03:32AM +0800, Fan Gong wrote: > According to comment of patch 03, check codes that were merged and > remove redundant defensive codes. > > Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com> > Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com> > Signed-off-by: Fan Gong <gongfan1@huawei.com> Hi, I agree that defensive coding is unnecessary in Networking drivers. But I'm unsure what "codes that were merged" and "patch 03" refers to. Could you clarify this? Likewise in patch 3/4 of this series.
On 1/28/2026 12:25 AM, Simon Horman wrote: > On Mon, Jan 26, 2026 at 09:03:32AM +0800, Fan Gong wrote: >> According to comment of patch 03, check codes that were merged and >> remove redundant defensive codes. >> >> Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com> >> Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com> >> Signed-off-by: Fan Gong <gongfan1@huawei.com> > > Hi, > > I agree that defensive coding is unnecessary in Networking drivers. > But I'm unsure what "codes that were merged" and "patch 03" refers to. > Could you clarify this? > > Likewise in patch 3/4 of this series. > Our negligence did not explain this clearly. Patch 03 points to the mergeed patch "net: hinic3: Add a driver for Huawei 3rd gen NIC - sw and hw initialization". "codes that were merged" means that we review the code already merged into Linux based on Jakub's review comments. https://lore.kernel.org/netdev/20250902180843.5ba05bf2@kernel.org/ At that time, "patch 03" could only modify the parts where the code was to be merged. Therefore, after we checked the previous codes ,the codes already merged are modified in this current patchset. Thanks, Fan gong
On Wed, Jan 28, 2026 at 02:50:37PM +0800, Fan Gong wrote:
> On 1/28/2026 12:25 AM, Simon Horman wrote:
> > On Mon, Jan 26, 2026 at 09:03:32AM +0800, Fan Gong wrote:
> >> According to comment of patch 03, check codes that were merged and
> >> remove redundant defensive codes.
> >>
> >> Co-developed-by: Zhu Yikai <zhuyikai1@h-partners.com>
> >> Signed-off-by: Zhu Yikai <zhuyikai1@h-partners.com>
> >> Signed-off-by: Fan Gong <gongfan1@huawei.com>
> >
> > Hi,
> >
> > I agree that defensive coding is unnecessary in Networking drivers.
> > But I'm unsure what "codes that were merged" and "patch 03" refers to.
> > Could you clarify this?
> >
> > Likewise in patch 3/4 of this series.
> >
>
> Our negligence did not explain this clearly.
>
> Patch 03 points to the mergeed patch "net: hinic3: Add a driver for Huawei 3rd
> gen NIC - sw and hw initialization".
>
> "codes that were merged" means that we review the code already merged into
> Linux based on Jakub's review comments.
> https://lore.kernel.org/netdev/20250902180843.5ba05bf2@kernel.org/
>
> At that time, "patch 03" could only modify the parts where the code was to be
> merged. Therefore, after we checked the previous codes ,the codes already
> merged are modified in this current patchset.
Thanks, and apologies if I still have this mixed up.
I'm wondering if the following commit message would make things clearer.
Subject: [PATCH net-next v3 2/4] hinic3: remove defensive txq_num check
Since commit 1f3838b84a63 ("hinic3: Add Rss function") nic_dev->num_txqs
cannot be zero in hinic3_alloc_txqs(). So remove the check for this case.
Link: https://lore.kernel.org/netdev/20250902180843.5ba05bf2@kernel.org/
Signed-off-by: ...
© 2016 - 2026 Red Hat, Inc.