]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: hns3: Add handle for default case
authorJian Shen <shenjian15@huawei.com>
Fri, 21 Sep 2018 15:41:42 +0000 (16:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 22 Sep 2018 02:29:32 +0000 (19:29 -0700)
There are a few "switch-case" codes missed handle for default case. For
some abnormal case, it should return error code instead of return 0.

Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c

index e404130a5114fb2354a41df9c22530436fe087fd..fc27f3fe0c5e4be9ad62c5a25fd26d656e6b0aa0 100644 (file)
@@ -2176,6 +2176,8 @@ static void hns3_rx_checksum(struct hns3_enet_ring *ring, struct sk_buff *skb,
                     l4_type == HNS3_L4_TYPE_SCTP))
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                break;
+       default:
+               break;
        }
 }
 
index ce2e6ea11bb7d0e10144db2adb4739fa3a49ab55..46701cf256db5ef1c4d98ea1d427007e694c2bfe 100644 (file)
@@ -351,9 +351,10 @@ static int hns3_get_sset_count(struct net_device *netdev, int stringset)
 
        case ETH_SS_TEST:
                return ops->get_sset_count(h, stringset);
-       }
 
-       return 0;
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 static void *hns3_update_strings(u8 *data, const struct hns3_stats *stats,
@@ -417,6 +418,8 @@ static void hns3_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
        case ETH_SS_TEST:
                ops->get_strings(h, stringset, data);
                break;
+       default:
+               break;
        }
 }
 
index 86d3d8b6fd2b884f9728bf857a5e24f65c947add..73d9d0d349d86693f297b3412cfcc55edfcaf639 100644 (file)
@@ -2224,6 +2224,8 @@ static void hclge_clear_event_cause(struct hclge_dev *hdev, u32 event_type,
        case HCLGE_VECTOR0_EVENT_MBX:
                hclge_write_dev(&hdev->hw, HCLGE_VECTOR0_CMDQ_SRC_REG, regclr);
                break;
+       default:
+               break;
        }
 }
 
@@ -5218,6 +5220,10 @@ static int hclge_init_client_instance(struct hnae3_client *client,
 
                                hnae3_set_client_init_flag(client, ae_dev, 1);
                        }
+
+                       break;
+               default:
+                       return -EINVAL;
                }
        }
 
index d8c0cc8e04c9dde553cb6b4a8df7a0f3cf7ee490..0d3b445f6799db7522eaacf2bcd5a55314a63138 100644 (file)
@@ -134,7 +134,7 @@ static int hclgevf_init_cmd_queue(struct hclgevf_dev *hdev,
 
                hclgevf_write_dev(hw, HCLGEVF_NIC_CSQ_HEAD_REG, 0);
                hclgevf_write_dev(hw, HCLGEVF_NIC_CSQ_TAIL_REG, 0);
-               break;
+               return 0;
        case HCLGEVF_TYPE_CRQ:
                reg_val = (u32)ring->desc_dma_addr;
                hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_BASEADDR_L_REG, reg_val);
@@ -147,10 +147,10 @@ static int hclgevf_init_cmd_queue(struct hclgevf_dev *hdev,
 
                hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_HEAD_REG, 0);
                hclgevf_write_dev(hw, HCLGEVF_NIC_CRQ_TAIL_REG, 0);
-               break;
+               return 0;
+       default:
+               return -EINVAL;
        }
-
-       return 0;
 }
 
 void hclgevf_cmd_setup_basic_desc(struct hclgevf_desc *desc,
index 84129c58e6fab8a0274f888073ff47afcf434464..b64418763b13c8a0a369a6f970df2e7c0bb353d7 100644 (file)
@@ -1667,6 +1667,9 @@ static int hclgevf_init_client_instance(struct hnae3_client *client,
                }
 
                hnae3_set_client_init_flag(client, ae_dev, 1);
+               break;
+       default:
+               return -EINVAL;
        }
 
        return 0;