* [PATCH net-next v03 1/4] hinic3: Fix code Style(remove empty lines between error handling)
2026-01-29 4:01 [PATCH net-next v03 0/4] net: hinic3: Fix code styles Fan Gong
@ 2026-01-29 4:01 ` Fan Gong
2026-01-29 20:12 ` Joe Damato
2026-01-29 4:01 ` [PATCH net-next v03 2/4] hinic3: Remove defensive txq_num check Fan Gong
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Fan Gong @ 2026-01-29 4:01 UTC (permalink / raw)
To: Fan Gong, Zhu Yikai, netdev, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: linux-kernel, linux-doc, luosifu, Xin Guo, Zhou Shuai, Wu Like,
Shi Jing, Luo Yang
According to previous review comment, fix code style of removing empty
lines between the actions on the error handling path to make it more
idiomatic in the merged code.
Link: https://lore.kernel.org/netdev/20250902180937.4c8d9eb3@kernel.org/
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_cmdq.c | 3 ---
drivers/net/ethernet/huawei/hinic3/hinic3_eqs.c | 1 -
drivers/net/ethernet/huawei/hinic3/hinic3_lld.c | 5 -----
drivers/net/ethernet/huawei/hinic3/hinic3_main.c | 4 ----
drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c | 2 --
drivers/net/ethernet/huawei/hinic3/hinic3_tx.c | 1 -
6 files changed, 16 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_cmdq.c b/drivers/net/ethernet/huawei/hinic3/hinic3_cmdq.c
index ef539d1b69a3..86720bb119e9 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_cmdq.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_cmdq.c
@@ -878,14 +878,11 @@ int hinic3_cmdqs_init(struct hinic3_hwdev *hwdev)
}
hinic3_free_db_addr(hwdev, cmdqs->cmdqs_db_base);
-
err_destroy_cmdq_wq:
destroy_cmdq_wq(hwdev, cmdqs);
-
err_free_cmdqs:
dma_pool_destroy(cmdqs->cmd_buf_pool);
kfree(cmdqs);
-
err_out:
return err;
}
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_eqs.c b/drivers/net/ethernet/huawei/hinic3/hinic3_eqs.c
index 1ecc2aca1e35..a2c3962116d5 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_eqs.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_eqs.c
@@ -686,7 +686,6 @@ int hinic3_aeqs_init(struct hinic3_hwdev *hwdev, u16 num_aeqs,
}
destroy_workqueue(aeqs->workq);
-
err_free_aeqs:
kfree(aeqs);
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_lld.c b/drivers/net/ethernet/huawei/hinic3/hinic3_lld.c
index 2b77fea1e0b3..87413e192f10 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_lld.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_lld.c
@@ -230,7 +230,6 @@ static int hinic3_mapping_bar(struct pci_dev *pdev,
iounmap(pci_adapter->mgmt_reg_base);
err_unmap_intr_reg_base:
iounmap(pci_adapter->intr_reg_base);
-
err_unmap_cfg_reg_base:
iounmap(pci_adapter->cfg_reg_base);
@@ -285,10 +284,8 @@ static int hinic3_pci_init(struct pci_dev *pdev)
err_release_regions:
pci_clear_master(pdev);
pci_release_regions(pdev);
-
err_disable_device:
pci_disable_device(pdev);
-
err_free_pci_adapter:
pci_set_drvdata(pdev, NULL);
mutex_destroy(&pci_adapter->pdev_mutex);
@@ -382,7 +379,6 @@ static int hinic3_probe_func(struct hinic3_pcidev *pci_adapter)
hinic3_func_uninit(pdev);
err_unmap_bar:
hinic3_unmapping_bar(pci_adapter);
-
err_out:
dev_err(&pdev->dev, "PCIe device probe function failed\n");
@@ -415,7 +411,6 @@ static int hinic3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_uninit_pci:
hinic3_pci_uninit(pdev);
-
err_out:
dev_err(&pdev->dev, "PCIe device probe failed\n");
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
index a33f86675954..6275d94dfefd 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_main.c
@@ -104,7 +104,6 @@ static int hinic3_alloc_txrxqs(struct net_device *netdev)
err_free_rxqs:
hinic3_free_rxqs(netdev);
-
err_free_txqs:
hinic3_free_txqs(netdev);
@@ -475,17 +474,14 @@ static int hinic3_nic_probe(struct auxiliary_device *adev,
disable_delayed_work_sync(&nic_dev->periodic_work);
hinic3_update_nic_feature(nic_dev, 0);
hinic3_set_nic_feature_to_hw(nic_dev);
-
err_uninit_sw:
hinic3_sw_uninit(netdev);
-
err_free_nic_io:
hinic3_free_nic_io(nic_dev);
err_free_nic_dev:
hinic3_free_nic_dev(nic_dev);
err_free_netdev:
free_netdev(netdev);
-
err_unregister_adev_event:
hinic3_adev_event_unregister(adev);
dev_err(&pdev->dev, "NIC service probe failed\n");
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c b/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
index 6eb441d6a590..c871fd0fb109 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_mbox.c
@@ -446,10 +446,8 @@ int hinic3_init_mbox(struct hinic3_hwdev *hwdev)
hinic3_uninit_func_mbox_msg_channel(hwdev);
err_uninit_mgmt_msg_ch:
uninit_mgmt_msg_channel(mbox);
-
err_destroy_workqueue:
destroy_workqueue(mbox->workq);
-
err_free_mbox:
kfree(mbox);
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
index ef32aed7d761..4e361c9bd043 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_tx.c
@@ -609,7 +609,6 @@ static netdev_tx_t hinic3_send_one_skb(struct sk_buff *skb,
err_drop_pkt:
dev_kfree_skb_any(skb);
-
err_out:
return NETDEV_TX_OK;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v03 1/4] hinic3: Fix code Style(remove empty lines between error handling)
2026-01-29 4:01 ` [PATCH net-next v03 1/4] hinic3: Fix code Style(remove empty lines between error handling) Fan Gong
@ 2026-01-29 20:12 ` Joe Damato
0 siblings, 0 replies; 8+ messages in thread
From: Joe Damato @ 2026-01-29 20:12 UTC (permalink / raw)
To: Fan Gong
Cc: Zhu Yikai, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Andrew Lunn, linux-kernel, linux-doc,
luosifu, Xin Guo, Zhou Shuai, Wu Like, Shi Jing, Luo Yang
On Thu, Jan 29, 2026 at 12:01:08PM +0800, Fan Gong wrote:
> According to previous review comment, fix code style of removing empty
Hm, I'm wondering if maybe the subject or commit message could be reworded a
little bit?
Maybe something simpler like:
Subject: [PATCH net-next v3 1/4] hinic3: Remove empty lines
Make error handling paths more idiomatic by removing empty lines.
Link: https://lore.kernel.org/netdev/20250902180937.4c8d9eb3@kernel.org/
Co-developed-by: ...
Signed-off-by: ...
Maybe Simon has a better suggestion.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v03 2/4] hinic3: Remove defensive txq_num check
2026-01-29 4:01 [PATCH net-next v03 0/4] net: hinic3: Fix code styles Fan Gong
2026-01-29 4:01 ` [PATCH net-next v03 1/4] hinic3: Fix code Style(remove empty lines between error handling) Fan Gong
@ 2026-01-29 4:01 ` Fan Gong
2026-01-29 4:01 ` [PATCH net-next v03 3/4] hinic3: Use array_size instead of multiplying Fan Gong
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Fan Gong @ 2026-01-29 4:01 UTC (permalink / raw)
To: Fan Gong, Zhu Yikai, netdev, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: linux-kernel, linux-doc, luosifu, Xin Guo, Zhou Shuai, Wu Like,
Shi Jing, Luo Yang
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/
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
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH net-next v03 3/4] hinic3: Use array_size instead of multiplying
2026-01-29 4:01 [PATCH net-next v03 0/4] net: hinic3: Fix code styles Fan Gong
2026-01-29 4:01 ` [PATCH net-next v03 1/4] hinic3: Fix code Style(remove empty lines between error handling) Fan Gong
2026-01-29 4:01 ` [PATCH net-next v03 2/4] hinic3: Remove defensive txq_num check Fan Gong
@ 2026-01-29 4:01 ` Fan Gong
2026-01-29 20:06 ` Joe Damato
2026-01-29 4:01 ` [PATCH net-next v03 4/4] hinic3: RQ use RQ_CTXT_PREF_CI_HI instead of SQ_CTXT_PREF_CI_HI Fan Gong
2026-01-30 3:00 ` [PATCH net-next v03 0/4] net: hinic3: Fix code styles patchwork-bot+netdevbpf
4 siblings, 1 reply; 8+ messages in thread
From: Fan Gong @ 2026-01-29 4:01 UTC (permalink / raw)
To: Fan Gong, Zhu Yikai, netdev, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: linux-kernel, linux-doc, luosifu, Xin Guo, Zhou Shuai, Wu Like,
Shi Jing, Luo Yang
Since commit 17fcb3dc12bb ("hinic3: module initialization and tx/rx logic")
use "size * sizeof(u64)" in hinic3_feature_nego.
Use array_size instead of multiplying can make it clearer.
Link: https://lore.kernel.org/netdev/20250911123120.GG30363@horms.kernel.org/
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_nic_cfg.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
index b6cc7bb7bb0c..44abccf9cb29 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_cfg.c
@@ -23,7 +23,8 @@ static int hinic3_feature_nego(struct hinic3_hwdev *hwdev, u8 opcode,
feature_nego.func_id = hinic3_global_func_id(hwdev);
feature_nego.opcode = opcode;
if (opcode == MGMT_MSG_CMD_OP_SET)
- memcpy(feature_nego.s_feature, s_feature, size * sizeof(u64));
+ memcpy(feature_nego.s_feature, s_feature,
+ array_size(size, sizeof(u64)));
mgmt_msg_params_init_default(&msg_params, &feature_nego,
sizeof(feature_nego));
@@ -37,7 +38,8 @@ static int hinic3_feature_nego(struct hinic3_hwdev *hwdev, u8 opcode,
}
if (opcode == MGMT_MSG_CMD_OP_GET)
- memcpy(s_feature, feature_nego.s_feature, size * sizeof(u64));
+ memcpy(s_feature, feature_nego.s_feature,
+ array_size(size, sizeof(u64)));
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v03 3/4] hinic3: Use array_size instead of multiplying
2026-01-29 4:01 ` [PATCH net-next v03 3/4] hinic3: Use array_size instead of multiplying Fan Gong
@ 2026-01-29 20:06 ` Joe Damato
0 siblings, 0 replies; 8+ messages in thread
From: Joe Damato @ 2026-01-29 20:06 UTC (permalink / raw)
To: Fan Gong
Cc: Zhu Yikai, netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Simon Horman, Andrew Lunn, linux-kernel, linux-doc,
luosifu, Xin Guo, Zhou Shuai, Wu Like, Shi Jing, Luo Yang
On Thu, Jan 29, 2026 at 12:01:10PM +0800, Fan Gong wrote:
> Since commit 17fcb3dc12bb ("hinic3: module initialization and tx/rx logic")
> use "size * sizeof(u64)" in hinic3_feature_nego.
> Use array_size instead of multiplying can make it clearer.
>
> Link: https://lore.kernel.org/netdev/20250911123120.GG30363@horms.kernel.org/
> 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_nic_cfg.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
create_cmdq_wq in hinic3_cmdq.c has a memcpy that could probably benefit from
array_size, but I'm not sure.
For this change though:
Reviewed-by: Joe Damato <joe@dama.to>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH net-next v03 4/4] hinic3: RQ use RQ_CTXT_PREF_CI_HI instead of SQ_CTXT_PREF_CI_HI
2026-01-29 4:01 [PATCH net-next v03 0/4] net: hinic3: Fix code styles Fan Gong
` (2 preceding siblings ...)
2026-01-29 4:01 ` [PATCH net-next v03 3/4] hinic3: Use array_size instead of multiplying Fan Gong
@ 2026-01-29 4:01 ` Fan Gong
2026-01-30 3:00 ` [PATCH net-next v03 0/4] net: hinic3: Fix code styles patchwork-bot+netdevbpf
4 siblings, 0 replies; 8+ messages in thread
From: Fan Gong @ 2026-01-29 4:01 UTC (permalink / raw)
To: Fan Gong, Zhu Yikai, netdev, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn
Cc: linux-kernel, linux-doc, luosifu, Xin Guo, Zhou Shuai, Wu Like,
Shi Jing, Luo Yang
Separate the CTX_PREF_CI_HI of rq and sq to improve readability.
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_nic_io.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
index d86cd1ba4605..90887d2bb127 100644
--- a/drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
+++ b/drivers/net/ethernet/huawei/hinic3/hinic3_nic_io.c
@@ -162,6 +162,9 @@ struct hinic3_clean_queue_ctxt {
#define SQ_CTXT_WQ_BLOCK_SET(val, member) \
FIELD_PREP(SQ_CTXT_WQ_BLOCK_##member##_MASK, val)
+/* reuse SQ macro for RQ because the hardware format is identical */
+#define RQ_CTXT_PREF_CI_HI(val) SQ_CTXT_PREF_CI_HI(val)
+
#define RQ_CTXT_PI_IDX_MASK GENMASK(15, 0)
#define RQ_CTXT_CI_IDX_MASK GENMASK(31, 16)
#define RQ_CTXT_CI_PI_SET(val, member) \
@@ -629,7 +632,8 @@ static void hinic3_rq_prepare_ctxt(struct hinic3_io_queue *rq,
RQ_CTXT_PREF_SET(RQ_WQ_PREFETCH_THRESHOLD, CACHE_THRESHOLD));
rq_ctxt->pref_ci_owner =
- cpu_to_le32(RQ_CTXT_PREF_SET(SQ_CTXT_PREF_CI_HI(ci_start), CI_HI) |
+ cpu_to_le32(RQ_CTXT_PREF_SET(RQ_CTXT_PREF_CI_HI(ci_start),
+ CI_HI) |
RQ_CTXT_PREF_SET(1, OWNER));
rq_ctxt->pref_wq_pfn_hi_ci =
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH net-next v03 0/4] net: hinic3: Fix code styles
2026-01-29 4:01 [PATCH net-next v03 0/4] net: hinic3: Fix code styles Fan Gong
` (3 preceding siblings ...)
2026-01-29 4:01 ` [PATCH net-next v03 4/4] hinic3: RQ use RQ_CTXT_PREF_CI_HI instead of SQ_CTXT_PREF_CI_HI Fan Gong
@ 2026-01-30 3:00 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-30 3:00 UTC (permalink / raw)
To: Fan Gong
Cc: zhuyikai1, netdev, davem, edumazet, kuba, pabeni, horms,
andrew+netdev, linux-kernel, linux-doc, luosifu, guoxin09,
zhoushuai28, wulike1, shijing34, luoyang82
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 29 Jan 2026 12:01:07 +0800 you wrote:
> This patchset provides 4 code styles fixes:
>
> Remove empty lines between error handling.
> Remove defensive txq_num check.
> Use array_size instead of multiplying.
> SQ use SQ_CTXT_PREF_CI_HI to improve readability.
>
> [...]
Here is the summary with links:
- [net-next,v03,1/4] hinic3: Fix code Style(remove empty lines between error handling)
https://git.kernel.org/netdev/net-next/c/738ff2d2f502
- [net-next,v03,2/4] hinic3: Remove defensive txq_num check
https://git.kernel.org/netdev/net-next/c/34bef6a4960f
- [net-next,v03,3/4] hinic3: Use array_size instead of multiplying
https://git.kernel.org/netdev/net-next/c/afb81efc971e
- [net-next,v03,4/4] hinic3: RQ use RQ_CTXT_PREF_CI_HI instead of SQ_CTXT_PREF_CI_HI
https://git.kernel.org/netdev/net-next/c/2da903d0a84a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 8+ messages in thread