Skip to content

Commit 2fc4cd5

Browse files
sacrenJeff Kirsher
authored andcommitted
i40e: fix unconditional execution of cpu_to_le16()
The commit 3092e5e4cc79 ("i40e: add little endian conversion for checksum") fixed the checksum bug on big-endian architecture. But we should not execute cpu_to_le16() unconditionally. Thus, put cpu_to_le16() under certain condition. Cc: Jesse Brandeburg <[email protected]> Cc: Paul M Stillwell Jr <[email protected]> Signed-off-by: Jean Sacren <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 0e5229c commit 2fc4cd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/intel/i40e/i40e_nvm.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,11 @@ i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
569569
__le16 le_sum;
570570

571571
ret_code = i40e_calc_nvm_checksum(hw, &checksum);
572-
le_sum = cpu_to_le16(checksum);
573-
if (!ret_code)
572+
if (!ret_code) {
573+
le_sum = cpu_to_le16(checksum);
574574
ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
575575
1, &le_sum, true);
576+
}
576577

577578
return ret_code;
578579
}

0 commit comments

Comments
 (0)