[PATCH -next] hinic: Use ARRAY_SIZE for nic_vf_cmd_msg_handler
From: Zou Wei
Date: Tue Apr 28 2020 - 23:09:38 EST
fix coccinelle warning, use ARRAY_SIZE
drivers/net/ethernet/huawei/hinic/hinic_sriov.c:713:43-44: WARNING: Use ARRAY_SIZE
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Zou Wei <zou_wei@xxxxxxxxxx>
---
drivers/net/ethernet/huawei/hinic/hinic_sriov.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
index b24788e..ac12725 100644
--- a/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
+++ b/drivers/net/ethernet/huawei/hinic/hinic_sriov.c
@@ -710,8 +710,7 @@ int nic_pf_mbox_handler(void *hwdev, u16 vf_id, u8 cmd, void *buf_in,
if (!hwdev)
return -EFAULT;
- cmd_number = sizeof(nic_vf_cmd_msg_handler) /
- sizeof(struct vf_cmd_msg_handle);
+ cmd_number = ARRAY_SIZE(nic_vf_cmd_msg_handler);
pfhwdev = container_of(dev, struct hinic_pfhwdev, hwdev);
nic_io = &dev->func_to_io;
for (i = 0; i < cmd_number; i++) {
--
2.6.2