Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1026759ybt; Fri, 19 Jun 2020 22:05:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtmLDAldLJs4+yH2P3JTEykkk/RfKg5S2ceZAySe8ejf17w5/rxBU2rygDi55x7D3Tge9m X-Received: by 2002:a17:906:470a:: with SMTP id y10mr6647465ejq.535.1592629520263; Fri, 19 Jun 2020 22:05:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592629520; cv=none; d=google.com; s=arc-20160816; b=bBlPFV4jLLIujvZtRQFxALAJZskfaG6emGLJhXIyxQndGSy+JncVZi6Zq/YxhcNPir Ln/8tLd3pSeP1QghAFq5mEeFdgiqidjTkcu/uACERLNU5ONYgf6uwchAvsoAtW+UtB04 pX2CEySDeJadptNvov0nQQ9/tZNyuTmgbyQVU25IGKeD4TflDMWsoaf2ImoDcm3Ghkyf vh67ShVw4bK8nRcQsRG0NRID9aswWDPOpOognUR4eAg1PfGysdYlgXKF7p3tKNucEp1U d2lkS85/gLNk8ToMQ2JvR8LPw1VvKcH5ZbVs7q9dx7RnWgrIzlNQ5e8/0Bau704O64ps DG7g== 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=Wz4YAUqNVrEOp5BqiaMSOI4cmYqEOro5poFKRBGqHro=; b=G3FCmAAzrkbVmtuAEfD+8AtoD6thWQji4+DQnZgmJcJYUlVOu/tJvBdDYqkp8KH8p/ 6u/iwMEsV3lybJLr2fwNE4zJQ4ktxB/l4Nn075pXYEs/yU2hibqHMNsmpVV/kyyJ5nkU ofkF15nKURhCfVDaIIODmv5Bk4/fOcusvJxzWIsqCO54k/YHppEgOrMNMrNqN19JJzmX 6h8/beat3z/cSH6ihcqFhhFHCCAtZB3wUk8SMelPVRqx9VRosB0D8bhEV6p4sz4BSMDR ieqe4S+cyeUirg6mfRofjxFX+vG2TpqZgQWCH4AZFPKEJ2JH6OcOeS8PjEC/AJIhT+32 EJJQ== 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 cm12si5046856edb.565.2020.06.19.22.04.58; Fri, 19 Jun 2020 22:05:20 -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 S1732084AbgFTCrJ (ORCPT + 99 others); Fri, 19 Jun 2020 22:47:09 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:48676 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731973AbgFTCrI (ORCPT ); Fri, 19 Jun 2020 22:47:08 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4EFA8DE9F8059814A852; Sat, 20 Jun 2020 10:47:06 +0800 (CST) Received: from huawei.com (10.175.104.57) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Sat, 20 Jun 2020 10:46:57 +0800 From: Li Heng To: , , , CC: , , Subject: [PATCH resend] net: cxgb4: fix return error value in t4_prep_fw Date: Sat, 20 Jun 2020 10:49:21 +0800 Message-ID: <1592621361-39925-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 Signed-off-by: Jakub Kicinski --- resent with netdev cced --- 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