On 3/10/26 1:09 PM, illusion.wang wrote:
+static int nbl_dev_configure_msix_map(struct nbl_dev_mgt *dev_mgt)
+{
+ struct nbl_dispatch_ops *disp_ops = dev_mgt->disp_ops_tbl->ops;
+ struct nbl_dev_common *dev_common = dev_mgt->common_dev;
+ struct nbl_msix_info *msix_info = &dev_common->msix_info;
+ bool mask_en = msix_info->serv_info[NBL_MSIX_NET_TYPE].hw_self_mask_en;
+ u16 msix_net_num = msix_info->serv_info[NBL_MSIX_NET_TYPE].num;
+ u16 msix_not_net_num = 0;
+ int err, i;
+
+ for (i = NBL_MSIX_NET_TYPE; i < NBL_MSIX_TYPE_MAX; i++)
+ msix_info->serv_info[i].base_vector_id =
+ msix_info->serv_info[i - 1].base_vector_id +
+ msix_info->serv_info[i - 1].num;
+
+ for (i = NBL_MSIX_MAILBOX_TYPE; i < NBL_MSIX_TYPE_MAX; i++) {
+ if (i == NBL_MSIX_NET_TYPE)
+ continue;
+
+ msix_not_net_num += msix_info->serv_info[i].num;
+ }
AI review says:
Is the condition `if (i == NBL_MSIX_NET_TYPE) continue;` correct here?
Looking at the enum in nbl_dev.h:
enum nbl_msix_type {
NBL_MSIX_VIRTIO_TYPE = 0,
NBL_MSIX_NET_TYPE = 1,
NBL_MSIX_MAILBOX_TYPE = 2,
NBL_MSIX_TYPE_MAX = 3,
};
The loop starts at NBL_MSIX_MAILBOX_TYPE (value 2) and continues to
NBL_MSIX_TYPE_MAX (value 3). Since the variable i never equals 1
(NBL_MSIX_NET_TYPE), this branch can never execute.
Should this dead code be removed, or should the loop start at a
different value if the intent was to skip NBL_MSIX_NET_TYPE?