Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 739fe4d1 authored by Li Heng's avatar Li Heng Committed by Greg Kroah-Hartman
Browse files

net: cxgb4: fix return error value in t4_prep_fw



[ Upstream commit 8a259e6b73ad8181b0b2ef338b35043433db1075 ]

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: 16e47624 ("cxgb4: Add new scheme to update T4/T5 firmware")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarLi Heng <liheng40@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e84c6ae1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3499,7 +3499,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) {
@@ -3528,7 +3528,7 @@ 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,
		ret = t4_fw_upgrade(adap, adap->mbox, fw_data,
				    fw_size, 0);
		if (ret != 0) {
			dev_err(adap->pdev_dev,
@@ -3560,7 +3560,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;
	}