mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 03:21:32 +00:00
rtl2800usb: Fix incorrect storage of MAC address on big-endian platforms
The eeprom data is stored in little-endian order in the rt2x00 library. As it was converted to cpu order in the read routines, the data need to be converted to LE on a big-endian platform. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Cc: Stable <stable@kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
d331eb51e4
commit
daabead1c3
@ -3697,14 +3697,15 @@ static void rt2800_efuse_read(struct rt2x00_dev *rt2x00dev, unsigned int i)
|
||||
rt2800_regbusy_read(rt2x00dev, EFUSE_CTRL, EFUSE_CTRL_KICK, ®);
|
||||
|
||||
/* Apparently the data is read from end to start */
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3,
|
||||
(u32 *)&rt2x00dev->eeprom[i]);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2,
|
||||
(u32 *)&rt2x00dev->eeprom[i + 2]);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1,
|
||||
(u32 *)&rt2x00dev->eeprom[i + 4]);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0,
|
||||
(u32 *)&rt2x00dev->eeprom[i + 6]);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA3, ®);
|
||||
/* The returned value is in CPU order, but eeprom is le */
|
||||
rt2x00dev->eeprom[i] = cpu_to_le32(reg);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA2, ®);
|
||||
*(u32 *)&rt2x00dev->eeprom[i + 2] = cpu_to_le32(reg);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA1, ®);
|
||||
*(u32 *)&rt2x00dev->eeprom[i + 4] = cpu_to_le32(reg);
|
||||
rt2800_register_read_lock(rt2x00dev, EFUSE_DATA0, ®);
|
||||
*(u32 *)&rt2x00dev->eeprom[i + 6] = cpu_to_le32(reg);
|
||||
|
||||
mutex_unlock(&rt2x00dev->csr_mutex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user