From patchwork Fri Sep 21 15:41:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147291 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp970892ljw; Fri, 21 Sep 2018 08:43:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaCApvy5HXO9uDZDj0fG8eE1I6DuISG5X0FPGZVkhcB6EjYafPiPXbn5i87agztatIQ7Dyw X-Received: by 2002:a62:89d8:: with SMTP id n85-v6mr46914580pfk.83.1537544589807; Fri, 21 Sep 2018 08:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537544589; cv=none; d=google.com; s=arc-20160816; b=xsUNuNBzJrG5ssn1rqdJjtsIPNiLxD8QPy5MojWnZaK6ijw/Xe19xTinfJsIFCIYQF wjqxFju1o4tZmYE4M+/iljLeNtiGn+xTr94DjiJutHds3BdQg+9YadVDVwOO3UWVBlAC Rq5R1W4Rqtu6LKhHbE62ut/kgTLFuN4QVm0FKx9hExPTN3Mg5C1Y/4cCOCmx7NGIMwxy tHcp1fFP16HaC0j0UfayVKA7+DRvkSStoxiTdWKGDkQqguirs3L80vFQaBCS20VqEfLc QCgNnYtPTFtrRkW7Q+X7J+KGITLsA4euwqtkuJ9pwQDfnYQ4oNWEeT+gWrn/YZIiaUbK 7/AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=UFTCfqeKFggQD1fFM14Ww6YFIYTakW+MMBP6x22TmqE=; b=L8m6j6QeO90iHj8qvxxoCKLSsDUno0UmcZQdHmyJfmYdrrAS2dWBdkhsFEGgoyYC+k tjHEsYIuSrKyNUbhmE/0/FzG7VkSa1ZnTy+iS/W58q9MsbTNVhzr1K0I+1l3UUHd42a7 o9QRys8lz+AYiu/mxzt6v7rJ5FDqLna89a3xa9p3XHTUAlmUjFBZzvVl3ZAFK1fsCflc qHXCjKmsH2LucRfKDBpfgcWXltMEWmjDQDrjtPU6HS3sG0N7N7QaPmqe6aAPsH1pCOoj CoL+ukTushepfVP/h9ZplLIdNGMC3IRhhBchJLFVZ5m82rNdCCn2Vifpyxaogy7Eas6k LjLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si5730199plq.339.2018.09.21.08.43.09; Fri, 21 Sep 2018 08:43:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390621AbeIUVcc (ORCPT + 32 others); Fri, 21 Sep 2018 17:32:32 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:43008 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390218AbeIUVcc (ORCPT ); Fri, 21 Sep 2018 17:32:32 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 09A709F5F7BC0; Fri, 21 Sep 2018 23:43:03 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 23:42:56 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 06/12] net: hns3: Add handle for default case Date: Fri, 21 Sep 2018 16:41:42 +0100 Message-ID: <20180921154148.26756-7-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180921154148.26756-1-salil.mehta@huawei.com> References: <20180921154148.26756-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen 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 Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 ++ drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 7 +++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++++ drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c | 8 ++++---- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 3 +++ 5 files changed, 20 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index e404130..fc27f3f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -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; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c index ce2e6ea..46701cf 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c @@ -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; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 86d3d8b..73d9d0d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -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; } } diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c index d8c0cc8..0d3b445 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c @@ -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, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 84129c5..b644187 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -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;