summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJean Sacren <sakiwit@gmail.com>2015-10-13 07:06:32 (GMT)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2015-10-23 12:40:49 (GMT)
commit2fc4cd52fa7ed86e9d1df94e459b6a2435bfa9c7 (patch)
treecd23a3af637c15bc513a167851b930aa9506ee7c /drivers
parent0e5229c6c576969bf8f89f8ca74fa7ea355b434e (diff)
downloadlinux-2fc4cd52fa7ed86e9d1df94e459b6a2435bfa9c7.tar.xz
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 <jesse.brandeburg@intel.com> Cc: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Signed-off-by: Jean Sacren <sakiwit@gmail.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_nvm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 1715358..6100cdd 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -569,10 +569,11 @@ i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
__le16 le_sum;
ret_code = i40e_calc_nvm_checksum(hw, &checksum);
- le_sum = cpu_to_le16(checksum);
- if (!ret_code)
+ if (!ret_code) {
+ 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;
}