]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: hns3: set default value for param "type" in hclgevf_bind_ring_to_vector
authorPeng Li <lipeng321@huawei.com>
Thu, 4 Jul 2019 14:04:24 +0000 (22:04 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Jul 2019 22:39:38 +0000 (15:39 -0700)
The value of param type is always not changed in
hclgevf_bind_ring_to_vector, move the assignment to
front of "for {}" can reduce the redundant assignment.

Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index ff7e8cb68ea8d1767933792bc2f21e7384797fe8..a13a0e101c3bfc96d2d2175edf26defa0ea173e6 100644 (file)
@@ -994,6 +994,8 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
        u8 type;
 
        req = (struct hclge_mbx_vf_to_pf_cmd *)desc.data;
+       type = en ? HCLGE_MBX_MAP_RING_TO_VECTOR :
+               HCLGE_MBX_UNMAP_RING_TO_VECTOR;
 
        for (node = ring_chain; node; node = node->next) {
                int idx_offset = HCLGE_MBX_RING_MAP_BASIC_MSG_NUM +
@@ -1003,9 +1005,6 @@ static int hclgevf_bind_ring_to_vector(struct hnae3_handle *handle, bool en,
                        hclgevf_cmd_setup_basic_desc(&desc,
                                                     HCLGEVF_OPC_MBX_VF_TO_PF,
                                                     false);
-                       type = en ?
-                               HCLGE_MBX_MAP_RING_TO_VECTOR :
-                               HCLGE_MBX_UNMAP_RING_TO_VECTOR;
                        req->msg[0] = type;
                        req->msg[1] = vector_id;
                }