mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 05:55:02 +08:00
intel: remove checker warning
The sparse checker (C=2) found an assignment where we were mixing types when trying to convert from data read directly from the device NVM, to an array in CPU order in-memory, which unfortunately the driver tries to do in-place. This is easily solved by using the swap operation instead of an assignment, and is already proven in other Intel drivers to be functionally correct and the same code, just without a sparse warning. The change is the same in all three drivers. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Dave Switzer <david.switzer@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
d4ef55288a
commit
c40591cc3d
@ -513,7 +513,7 @@ static int e1000_set_eeprom(struct net_device *netdev,
|
||||
memcpy(ptr, bytes, eeprom->len);
|
||||
|
||||
for (i = 0; i < last_word - first_word + 1; i++)
|
||||
eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
|
||||
cpu_to_le16s(&eeprom_buff[i]);
|
||||
|
||||
ret_val = e1000_write_eeprom(hw, first_word,
|
||||
last_word - first_word + 1, eeprom_buff);
|
||||
|
@ -831,7 +831,7 @@ static int igb_set_eeprom(struct net_device *netdev,
|
||||
memcpy(ptr, bytes, eeprom->len);
|
||||
|
||||
for (i = 0; i < last_word - first_word + 1; i++)
|
||||
eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
|
||||
cpu_to_le16s(&eeprom_buff[i]);
|
||||
|
||||
ret_val = hw->nvm.ops.write(hw, first_word,
|
||||
last_word - first_word + 1, eeprom_buff);
|
||||
|
@ -554,7 +554,7 @@ static int igc_ethtool_set_eeprom(struct net_device *netdev,
|
||||
memcpy(ptr, bytes, eeprom->len);
|
||||
|
||||
for (i = 0; i < last_word - first_word + 1; i++)
|
||||
eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
|
||||
cpu_to_le16s(&eeprom_buff[i]);
|
||||
|
||||
ret_val = hw->nvm.ops.write(hw, first_word,
|
||||
last_word - first_word + 1, eeprom_buff);
|
||||
|
Loading…
Reference in New Issue
Block a user