Skip to content

Commit 8a259e6

Browse files
Li Hengdavem330
authored andcommitted
net: cxgb4: fix return error value in t4_prep_fw
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: 16e4762 ("cxgb4: Add new scheme to update T4/T5 firmware") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Li Heng <liheng40@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e708e2b commit 8a259e6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • drivers/net/ethernet/chelsio/cxgb4

‎drivers/net/ethernet/chelsio/cxgb4/t4_hw.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3493,7 +3493,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
34933493
drv_fw = &fw_info->fw_hdr;
34943494

34953495
/* Read the header of the firmware on the card */
3496-
ret = -t4_read_flash(adap, FLASH_FW_START,
3496+
ret = t4_read_flash(adap, FLASH_FW_START,
34973497
sizeof(*card_fw) / sizeof(uint32_t),
34983498
(uint32_t *)card_fw, 1);
34993499
if (ret == 0) {
@@ -3522,8 +3522,8 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
35223522
should_install_fs_fw(adap, card_fw_usable,
35233523
be32_to_cpu(fs_fw->fw_ver),
35243524
be32_to_cpu(card_fw->fw_ver))) {
3525-
ret = -t4_fw_upgrade(adap, adap->mbox, fw_data,
3526-
fw_size, 0);
3525+
ret = t4_fw_upgrade(adap, adap->mbox, fw_data,
3526+
fw_size, 0);
35273527
if (ret != 0) {
35283528
dev_err(adap->pdev_dev,
35293529
"failed to install firmware: %d\n", ret);
@@ -3554,7 +3554,7 @@ int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
35543554
FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c),
35553555
FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k),
35563556
FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k));
3557-
ret = EINVAL;
3557+
ret = -EINVAL;
35583558
goto bye;
35593559
}
35603560

0 commit comments

Comments
 (0)