Hi Kalle On Wed, Jan 31, 2024 at 09:48:44AM +0200, Kalle Valo wrote: > Kalle Valo <kvalo@xxxxxxxxxx> writes: > > > Sparse warns: > > > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10949:39: warning: incorrect type in assignment (different base types) > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10949:39: expected unsigned int [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10949:39: got restricted __le32 [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10951:43: warning: incorrect type in assignment (different base types) > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10951:43: expected unsigned int [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10951:43: got restricted __le32 [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10953:43: warning: incorrect type in assignment (different base types) > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10953:43: expected unsigned int [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10953:43: got restricted __le32 [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10955:43: warning: incorrect type in assignment (different base types) > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10955:43: expected unsigned int [usertype] > > drivers/net/wireless/ralink/rt2x00/rt2800lib.c:10955:43: got restricted __le32 [usertype] > > > > rt2x00 does some wicked casting here so no wonder sparse warns. Clean that up > > and use cpu_to_le16() to avoid any warnings. > > > > Compile tested only. > > > > Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxx> > > Stanislaw, sorry somehow I corrupted your address but fixed it now. Let > me know what you think, patch here: > > https://patchwork.kernel.org/project/linux-wireless/patch/20240130151556.2315951-5-kvalo@xxxxxxxxxx/ If I analyse it correctly, patch is not ok on Big Endian machines where we do bytes swapping. Let asume reg value is 0x0D0C0B0A On previous code: - *(u32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); result is eeprom[0] = 0x0D eeprom[1] = 0x0C eeprom[2] = 0x0B eeprom[3] = 0x0A After modification: + rt2x00dev->eeprom[i] = cpu_to_le16(reg); + rt2x00dev->eeprom[i + 1] = cpu_to_le16(upper_16_bits(reg)); result will be eeprom[0] = 0x0B eeprom[1] = 0x0A eeprom[2] = 0x0D eeprom[2] = 0x0C Maybe just casting to __le32, i.e: *(__le32 *)&rt2x00dev->eeprom[i] = cpu_to_le32(reg); would solve the problem ? Regards Stanislaw