Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2966233ybt; Mon, 29 Jun 2020 11:40:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2PCLq9MpFlrrBZQYPsY2hm0NlAUn1vaySDYU027a6wC3a4GCFxCEEI2kA8Y/x+cYaO/MR X-Received: by 2002:a17:907:4240:: with SMTP id oi24mr14669896ejb.23.1593456000532; Mon, 29 Jun 2020 11:40:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593456000; cv=none; d=google.com; s=arc-20160816; b=gptPyZG78nh5l/tVRBvRgmzMjhcXFilX/IRez7pl7cRVN4gL4gUcRZeOMpTqdc7wT8 wHKJZOlpou6n7/nCvJVf+KThaG7u7o+RZuYcNHSl5DepmDkZSYNml+JaB3eGDvyLIhqg D5f9Ue7y5JlZieK6NbqR+Ka4lCt7dNg45hjQ3lAlEW5l8PailqKR/CTQBpMLNk0klStc TN8ukSvN6BTZHRrPLjUv0qj9IM0SGfKdDBR8Qmi1KgPlOaMSoiLjB5bnWxRQeWzTtUd8 vv+y4qCodLfTyq9VQxStwe9O4C+EAenxlqcCsmzZMEnF9nPH+w5NTAFr8QGNJ9iJbrQC aDLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=MnHdpzedPkVpLjjwLmXYLACRXZgt9IEg/Fshygzl0dI=; b=A1xBXswYZtL8v3nasQytg1dyHOpDziLTMS6WejiDw4+SNHxJuFyq0xlmbI8w3+1KmB SpNj1Gx/zxcK4GDVALpFR6rFhzwopOGvHCj7dkY8ixIQVhQ7I/Mi+MPi2r1lZdaeIITl NSG5g0f/f6H0Uf1eopYvVCJT9dU3hmCIP2mG+a+WPouTMaKTGau+pSlyw0Mx1yEM+hEh 7kPFymBklhezNmcDUNZR/nc+ArVO4hFzARFHIwOLBjRg2QuS5zFIqbdERbLwoMBmYcdx euraYbVtNpgWEuICh9KjR6YYaIXYBkr0TpX8WrmACbKw3IHDUXaYyVSginaZSJl/0c2W KP/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p13si263660ejd.637.2020.06.29.11.39.36; Mon, 29 Jun 2020 11:40:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728037AbgF2Si2 (ORCPT + 99 others); Mon, 29 Jun 2020 14:38:28 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:6782 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728022AbgF2Si0 (ORCPT ); Mon, 29 Jun 2020 14:38:26 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 2C51613923748716BC46; Mon, 29 Jun 2020 18:47:47 +0800 (CST) Received: from huawei.com (10.175.104.57) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Mon, 29 Jun 2020 18:47:41 +0800 From: Li Heng To: , , , CC: , Subject: [PATCH] net: cxgb4: fix return error value in t4_prep_fw Date: Mon, 29 Jun 2020 18:49:51 +0800 Message-ID: <1593427791-41194-1-git-send-email-liheng40@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.57] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org t4_prep_fw goto bye tag with positive return value when something bad happened and which can not free resource in adap_init0. so fix it to return negative value. Fixes: 16e47624e76b ("cxgb4: Add new scheme to update T4/T5 firmware") Reported-by: Hulk Robot Signed-off-by: Li Heng --- drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 2a3480f..9121cef 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c @@ -3493,7 +3493,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, drv_fw = &fw_info->fw_hdr; /* Read the header of the firmware on the card */ - ret = -t4_read_flash(adap, FLASH_FW_START, + ret = t4_read_flash(adap, FLASH_FW_START, sizeof(*card_fw) / sizeof(uint32_t), (uint32_t *)card_fw, 1); if (ret == 0) { @@ -3522,8 +3522,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, should_install_fs_fw(adap, card_fw_usable, be32_to_cpu(fs_fw->fw_ver), be32_to_cpu(card_fw->fw_ver))) { - ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, - fw_size, 0); + ret = t4_fw_upgrade(adap, adap->mbox, fw_data, + fw_size, 0); if (ret != 0) { dev_err(adap->pdev_dev, "failed to install firmware: %d\n", ret); @@ -3554,7 +3554,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c), FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k), FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); - ret = EINVAL; + ret = -EINVAL; goto bye; } -- 2.7.4