mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 18:11:39 +00:00
bnxt_en: fix error handling when flashing from file
[ Upstream commit22630e28f9
] After bnxt_hwrm_do_send_message() was updated to return standard error codes in a recent commit, a regression in bnxt_flash_package_from_file() was introduced. The return value does not properly reflect all possible firmware errors when calling firmware to flash the package. Fix it by consolidating all errors in one local variable rc instead of having 2 variables for different errors. Fixes:d4f1420d36
("bnxt_en: Convert error code in firmware message response to standard code.") Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
97207f4910
commit
4461ae0c15
1 changed files with 11 additions and 13 deletions
|
@ -2005,8 +2005,8 @@ static int bnxt_flash_package_from_file(struct net_device *dev,
|
||||||
struct hwrm_nvm_install_update_output *resp = bp->hwrm_cmd_resp_addr;
|
struct hwrm_nvm_install_update_output *resp = bp->hwrm_cmd_resp_addr;
|
||||||
struct hwrm_nvm_install_update_input install = {0};
|
struct hwrm_nvm_install_update_input install = {0};
|
||||||
const struct firmware *fw;
|
const struct firmware *fw;
|
||||||
int rc, hwrm_err = 0;
|
|
||||||
u32 item_len;
|
u32 item_len;
|
||||||
|
int rc = 0;
|
||||||
u16 index;
|
u16 index;
|
||||||
|
|
||||||
bnxt_hwrm_fw_set_time(bp);
|
bnxt_hwrm_fw_set_time(bp);
|
||||||
|
@ -2050,15 +2050,14 @@ static int bnxt_flash_package_from_file(struct net_device *dev,
|
||||||
memcpy(kmem, fw->data, fw->size);
|
memcpy(kmem, fw->data, fw->size);
|
||||||
modify.host_src_addr = cpu_to_le64(dma_handle);
|
modify.host_src_addr = cpu_to_le64(dma_handle);
|
||||||
|
|
||||||
hwrm_err = hwrm_send_message(bp, &modify,
|
rc = hwrm_send_message(bp, &modify, sizeof(modify),
|
||||||
sizeof(modify),
|
FLASH_PACKAGE_TIMEOUT);
|
||||||
FLASH_PACKAGE_TIMEOUT);
|
|
||||||
dma_free_coherent(&bp->pdev->dev, fw->size, kmem,
|
dma_free_coherent(&bp->pdev->dev, fw->size, kmem,
|
||||||
dma_handle);
|
dma_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_firmware(fw);
|
release_firmware(fw);
|
||||||
if (rc || hwrm_err)
|
if (rc)
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|
||||||
if ((install_type & 0xffff) == 0)
|
if ((install_type & 0xffff) == 0)
|
||||||
|
@ -2067,20 +2066,19 @@ static int bnxt_flash_package_from_file(struct net_device *dev,
|
||||||
install.install_type = cpu_to_le32(install_type);
|
install.install_type = cpu_to_le32(install_type);
|
||||||
|
|
||||||
mutex_lock(&bp->hwrm_cmd_lock);
|
mutex_lock(&bp->hwrm_cmd_lock);
|
||||||
hwrm_err = _hwrm_send_message(bp, &install, sizeof(install),
|
rc = _hwrm_send_message(bp, &install, sizeof(install),
|
||||||
INSTALL_PACKAGE_TIMEOUT);
|
INSTALL_PACKAGE_TIMEOUT);
|
||||||
if (hwrm_err) {
|
if (rc) {
|
||||||
u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err;
|
u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err;
|
||||||
|
|
||||||
if (resp->error_code && error_code ==
|
if (resp->error_code && error_code ==
|
||||||
NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) {
|
NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) {
|
||||||
install.flags |= cpu_to_le16(
|
install.flags |= cpu_to_le16(
|
||||||
NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG);
|
NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG);
|
||||||
hwrm_err = _hwrm_send_message(bp, &install,
|
rc = _hwrm_send_message(bp, &install, sizeof(install),
|
||||||
sizeof(install),
|
INSTALL_PACKAGE_TIMEOUT);
|
||||||
INSTALL_PACKAGE_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
if (hwrm_err)
|
if (rc)
|
||||||
goto flash_pkg_exit;
|
goto flash_pkg_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2092,7 +2090,7 @@ static int bnxt_flash_package_from_file(struct net_device *dev,
|
||||||
flash_pkg_exit:
|
flash_pkg_exit:
|
||||||
mutex_unlock(&bp->hwrm_cmd_lock);
|
mutex_unlock(&bp->hwrm_cmd_lock);
|
||||||
err_exit:
|
err_exit:
|
||||||
if (hwrm_err == -EACCES)
|
if (rc == -EACCES)
|
||||||
bnxt_print_admin_err(bp);
|
bnxt_print_admin_err(bp);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue