Skip to content

Commit

Permalink
net/i40e/base: fix using checksum before check
Browse files Browse the repository at this point in the history
[ upstream commit e59d949 ]

The variable checksum from i40e_calc_nvm_checksum is used before return
value is checked. Fix this logic.

Fixes: 8db9e2a ("i40e: base driver")
Fixes: 3ed6c32 ("i40e/base: handle AQ timeout when releasing NVM")

Signed-off-by: Christopher Pau <christopher.pau@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
  • Loading branch information
RobinXZhang authored and cpaelzer committed Nov 30, 2021
1 parent 8406d53 commit e67b39e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/i40e/base/i40e_nvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,11 @@ enum i40e_status_code i40e_update_nvm_checksum(struct i40e_hw *hw)
DEBUGFUNC("i40e_update_nvm_checksum");

ret_code = i40e_calc_nvm_checksum(hw, &checksum);
le_sum = CPU_TO_LE16(checksum);
if (ret_code == I40E_SUCCESS)
if (ret_code == I40E_SUCCESS) {
le_sum = CPU_TO_LE16(checksum);
ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
1, &le_sum, true);
}

return ret_code;
}
Expand Down

0 comments on commit e67b39e

Please sign in to comment.