bnxt_en: fix error handling when flashing from file
[ Upstream commit 22630e28f9c2b55abd217869cc0696def89f2284 ] 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: d4f1420d3656 ("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
@ -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_input install = {0};
|
||||
const struct firmware *fw;
|
||||
int rc, hwrm_err = 0;
|
||||
u32 item_len;
|
||||
int rc = 0;
|
||||
u16 index;
|
||||
|
||||
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);
|
||||
modify.host_src_addr = cpu_to_le64(dma_handle);
|
||||
|
||||
hwrm_err = hwrm_send_message(bp, &modify,
|
||||
sizeof(modify),
|
||||
FLASH_PACKAGE_TIMEOUT);
|
||||
rc = hwrm_send_message(bp, &modify, sizeof(modify),
|
||||
FLASH_PACKAGE_TIMEOUT);
|
||||
dma_free_coherent(&bp->pdev->dev, fw->size, kmem,
|
||||
dma_handle);
|
||||
}
|
||||
}
|
||||
release_firmware(fw);
|
||||
if (rc || hwrm_err)
|
||||
if (rc)
|
||||
goto err_exit;
|
||||
|
||||
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);
|
||||
|
||||
mutex_lock(&bp->hwrm_cmd_lock);
|
||||
hwrm_err = _hwrm_send_message(bp, &install, sizeof(install),
|
||||
INSTALL_PACKAGE_TIMEOUT);
|
||||
if (hwrm_err) {
|
||||
rc = _hwrm_send_message(bp, &install, sizeof(install),
|
||||
INSTALL_PACKAGE_TIMEOUT);
|
||||
if (rc) {
|
||||
u8 error_code = ((struct hwrm_err_output *)resp)->cmd_err;
|
||||
|
||||
if (resp->error_code && error_code ==
|
||||
NVM_INSTALL_UPDATE_CMD_ERR_CODE_FRAG_ERR) {
|
||||
install.flags |= cpu_to_le16(
|
||||
NVM_INSTALL_UPDATE_REQ_FLAGS_ALLOWED_TO_DEFRAG);
|
||||
hwrm_err = _hwrm_send_message(bp, &install,
|
||||
sizeof(install),
|
||||
INSTALL_PACKAGE_TIMEOUT);
|
||||
rc = _hwrm_send_message(bp, &install, sizeof(install),
|
||||
INSTALL_PACKAGE_TIMEOUT);
|
||||
}
|
||||
if (hwrm_err)
|
||||
if (rc)
|
||||
goto flash_pkg_exit;
|
||||
}
|
||||
|
||||
@ -2092,7 +2090,7 @@ static int bnxt_flash_package_from_file(struct net_device *dev,
|
||||
flash_pkg_exit:
|
||||
mutex_unlock(&bp->hwrm_cmd_lock);
|
||||
err_exit:
|
||||
if (hwrm_err == -EACCES)
|
||||
if (rc == -EACCES)
|
||||
bnxt_print_admin_err(bp);
|
||||
return rc;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user