From: Guangbin Huang huangguangbin2@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
This patch modifies the logic of two code in function hns3_parse_vlan_tag() to reduce the indentation level. It does not affect the original function of the code.
Signed-off-by: Guangbin Huang huangguangbin2@huawei.com Reviewed-by: Yunsheng Lin linyunsheng@huawei.com Reviewed-by: Zhong Zhaohui zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 35e8c32..35a607b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2858,21 +2858,19 @@ static bool hns3_parse_vlan_tag(struct hns3_enet_ring *ring, switch (hnae3_get_field(l234info, HNS3_RXD_STRP_TAGP_M, HNS3_RXD_STRP_TAGP_S)) { case HNS3_STRP_OUTER_VLAN: - if (handle->port_base_vlan_state == - HNAE3_PORT_BASE_VLAN_DISABLE) { - *vlan_tag = le16_to_cpu(desc->rx.ot_vlan_tag); - return true; - } + if (handle->port_base_vlan_state != + HNAE3_PORT_BASE_VLAN_DISABLE) + return false;
- return false; + *vlan_tag = le16_to_cpu(desc->rx.ot_vlan_tag); + return true; case HNS3_STRP_INNER_VLAN: - if (handle->port_base_vlan_state == - HNAE3_PORT_BASE_VLAN_DISABLE) { - *vlan_tag = le16_to_cpu(desc->rx.vlan_tag); - return true; - } + if (handle->port_base_vlan_state != + HNAE3_PORT_BASE_VLAN_DISABLE) + return false;
- return false; + *vlan_tag = le16_to_cpu(desc->rx.vlan_tag); + return true; case HNS3_STRP_BOTH: if (handle->port_base_vlan_state == HNAE3_PORT_BASE_VLAN_DISABLE)