From patchwork Fri May 28 08:55:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen \(ThunderTown\)" X-Patchwork-Id: 449484 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp153367jac; Fri, 28 May 2021 01:56:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMienl18L/+5JrNK9NjPgIbtiLTUAduQHPUGW7Rl5f4YpaMcKftuSN9uRmo7g3pci8VQvN X-Received: by 2002:a02:688:: with SMTP id 130mr7807788jav.48.1622192191349; Fri, 28 May 2021 01:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622192191; cv=none; d=google.com; s=arc-20160816; b=XNg4lmC2/pN6Q+QUJR4l50yL65Cs+LVjebBgsDEox8P75h7el61wWE08Mu9M9cwMAT v1/41q26w6U9Vq+V9n4IS46VPb14Y0awJmGBKEfTvSyU12vHcmpTFNxhJBOGkS2JMbjr 1OIyUxBETGcB77kcvWvNWY74soWG6ia+A8C1mSTxIvHUJ+e3NCals5hkyFm16j2vtqnj R59PxUZp7dnN0iFONxL9C8ZZsyaY4ianyI9QQZYdJ9GzzU1orsCipiYkwIDDTxn2Auf3 VYMJSbRBUPMSbTorjDeLj0ME7lw3p4MK5qFXrm8GFY3dvaziclM7db89lz28cW2O6RdA 7Krw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fpyWpfpZGpi6mABTZXnWFNUCfFusVMZ7fHWgPhTEb00=; b=Z+nc8wnCvv+0cas79DgB48VT6JcnKM5wyfZw28uUC2BcEfNzyqqWSThjJQ5CS5oazg /Zyq45Sh+zMOgc1h/TT6C1Pryh+bvxnvTrpZ6wi0hUH9D1D+SA87Q7SpJ0VXHYoeBIwg HAru3b4XY4HWfkwYNI5KGjJg+9971YRGfQlG8CabZRofEGT3+OshWGvbNMCEG3SRxYz2 2NncTyZS/AhXicvvXv4oGU1+TxpSUnuL1BDdiJ55JXRD2TS8Jb2kwYbTHeh6v5yrGuOh 94r9HQb0ErXqk4dQQEnaN2v3+6MB9LQznGrMPqXZ0SLsMD68KWqCaOV3SkTofsiWLpPN Y5uQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z89si5696356jah.125.2021.05.28.01.56.31; Fri, 28 May 2021 01:56:31 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235980AbhE1I6E (ORCPT + 8 others); Fri, 28 May 2021 04:58:04 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:5129 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235116AbhE1I6C (ORCPT ); Fri, 28 May 2021 04:58:02 -0400 Received: from dggeml717-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Frz4R0RkDzYn0x; Fri, 28 May 2021 16:53:43 +0800 (CST) Received: from dggpemm500006.china.huawei.com (7.185.36.236) by dggeml717-chm.china.huawei.com (10.3.17.128) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 28 May 2021 16:56:23 +0800 Received: from thunder-town.china.huawei.com (10.174.177.72) by dggpemm500006.china.huawei.com (7.185.36.236) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 28 May 2021 16:56:22 +0800 From: Zhen Lei To: Douglas Miller , "David S . Miller" , Jakub Kicinski , Jeff Garzik , Jan-Bernd Themann , netdev , linux-kernel CC: Zhen Lei Subject: [PATCH 1/1] ehea: fix error return code in ehea_restart_qps() Date: Fri, 28 May 2021 16:55:55 +0800 Message-ID: <20210528085555.9390-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.177.72] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500006.china.huawei.com (7.185.36.236) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Fix to return -EFAULT from the error handling case instead of 0, as done elsewhere in this function. By the way, when get_zeroed_page() fails, directly return -ENOMEM to simplify code. Fixes: 2c69448bbced ("ehea: DLPAR memory add fix") Reported-by: Hulk Robot Signed-off-by: Zhen Lei --- drivers/net/ethernet/ibm/ehea/ehea_main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index ea55314b209d..d105bfbc7c1c 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c @@ -2618,10 +2618,8 @@ static int ehea_restart_qps(struct net_device *dev) u16 dummy16 = 0; cb0 = (void *)get_zeroed_page(GFP_KERNEL); - if (!cb0) { - ret = -ENOMEM; - goto out; - } + if (!cb0) + return -ENOMEM; for (i = 0; i < (port->num_def_qps); i++) { struct ehea_port_res *pr = &port->port_res[i]; @@ -2641,6 +2639,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0); if (hret != H_SUCCESS) { netdev_err(dev, "query_ehea_qp failed (1)\n"); + ret = -EFAULT; goto out; } @@ -2653,6 +2652,7 @@ static int ehea_restart_qps(struct net_device *dev) &dummy64, &dummy16, &dummy16); if (hret != H_SUCCESS) { netdev_err(dev, "modify_ehea_qp failed (1)\n"); + ret = -EFAULT; goto out; } @@ -2661,6 +2661,7 @@ static int ehea_restart_qps(struct net_device *dev) cb0); if (hret != H_SUCCESS) { netdev_err(dev, "query_ehea_qp failed (2)\n"); + ret = -EFAULT; goto out; }