Received: by 10.223.185.111 with SMTP id b44csp1005624wrg; Fri, 9 Mar 2018 19:00:30 -0800 (PST) X-Google-Smtp-Source: AG47ELv+ZsvBNy4M2pVah8YORVritY2Ym+fTC3THLSxCUMvqOd7d1o/FwzT3BoDjME8bN6ULZd2L X-Received: by 2002:a17:902:2e04:: with SMTP id q4-v6mr711320plb.22.1520650830511; Fri, 09 Mar 2018 19:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520650830; cv=none; d=google.com; s=arc-20160816; b=Y2rtUS2ys0TZr7Zwb/58VFcWCieT/y6ZZ9+j9I9i2qnE6CrCgvNY3UuK8QcxQfK06e Ts2uXv/2RT9mAjN1GxBdaXTwg9ZavF9bfGAOUQxA+ExDhmJTT/KW9KGP4kjE2UvY70mv pYPe8GPa8NO0jaUgfOMHpH3q/JGGLKBWIScloIqwErmQ6mCiTPgh5603H0tp0LVvqWTA MV6u3UjQRAd8sRlW9uJ3tFZI0okcdU/ZqAd7aob8d0wAQwjkzR3eqFDNVSWU4WGFu5j7 7ldOFsXbgymPAZweQsI9odRqEeOhGX5/j5GT2BrtQsx1BNvUMuQ+GRvjn1EJtsU4kkuu O45Q== 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:arc-authentication-results; bh=q+jg8CP9IDOr/61Qzsx6EYrnexELPYeayvhsgIf5jtQ=; b=gJIrZAquNckS4b8Rt2FeqTM8asYhKWEr972+CXwXFtROetVqVxSCOUuqbTSmlnbP59 wydUY/Vbbx27OoC3KSC/GoQylQBUOjTgmv6u10ecjVwm/5PPdHLXkXWXuMpLmWmUiXen R3Ds1Zi+cML0FXVO8xK0hWDD+tQv+yZw2ggDgNyIaXt9tKX0N6vsFLxGKUYoTSiNkg7Y uEgDIuyMzvd1cSAH0n7ajfeO/zcMbF2ow/BdPB8hFHJlXB3vdtMC9i9cReOku2T/kGoI /z2xU8kSNREcHxDXmLTcvHeTzCxGC20z4rl1TmLIdB+ZgxefmPz63fPviHP5LskxB7Cm mFgw== 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 s4si1943768pfm.223.2018.03.09.19.00.16; Fri, 09 Mar 2018 19:00:30 -0800 (PST) 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 S932971AbeCJC6f (ORCPT + 99 others); Fri, 9 Mar 2018 21:58:35 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6226 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751880AbeCJC5j (ORCPT ); Fri, 9 Mar 2018 21:57:39 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5D4CCC5524832; Sat, 10 Mar 2018 10:57:26 +0800 (CST) Received: from linux-ioko.site (10.71.200.31) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.361.1; Sat, 10 Mar 2018 10:57:17 +0800 From: Peng Li To: CC: , , , , Subject: [PATCH net-next 10/12] net: hns3: fix return value error of hclge_get_mac_vlan_cmd_status() Date: Sat, 10 Mar 2018 11:29:31 +0800 Message-ID: <1520652573-75644-11-git-send-email-lipeng321@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> References: <1520652573-75644-1-git-send-email-lipeng321@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.71.200.31] 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 Error code -EIO was used to indicate mutilple errors in function hclge_get_mac_vlan_cmd_status().This patch fixes it by using error code depending on the error type. For no space error, return -ENOSPC. For entry not found, return -ENOENT. For command send fail, return -EIO. For invalid op code, return -EINVAL. Fixes: 46a3df9f9718 ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support") Signed-off-by: Jian Shen Signed-off-by: Peng Li --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index ba84281..47dcc98 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3779,11 +3779,11 @@ static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, if ((!resp_code) || (resp_code == 1)) { return_status = 0; } else if (resp_code == 2) { - return_status = -EIO; + return_status = -ENOSPC; dev_err(&hdev->pdev->dev, "add mac addr failed for uc_overflow.\n"); } else if (resp_code == 3) { - return_status = -EIO; + return_status = -ENOSPC; dev_err(&hdev->pdev->dev, "add mac addr failed for mc_overflow.\n"); } else { @@ -3795,7 +3795,7 @@ static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, if (!resp_code) { return_status = 0; } else if (resp_code == 1) { - return_status = -EIO; + return_status = -ENOENT; dev_dbg(&hdev->pdev->dev, "remove mac addr failed for miss.\n"); } else { @@ -3807,7 +3807,7 @@ static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, if (!resp_code) { return_status = 0; } else if (resp_code == 1) { - return_status = -EIO; + return_status = -ENOENT; dev_dbg(&hdev->pdev->dev, "lookup mac addr failed for miss.\n"); } else { @@ -3816,7 +3816,7 @@ static int hclge_get_mac_vlan_cmd_status(struct hclge_vport *vport, resp_code); } } else { - return_status = -EIO; + return_status = -EINVAL; dev_err(&hdev->pdev->dev, "unknown opcode for get_mac_vlan_cmd_status,opcode=%d.\n", op); -- 2.9.3