Search Linux Wireless

Re: BUG: endianness issues with libertas if_spi.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Holger.  Thanks for checking these and for all your recent work
with Libertas!

On Fri, Oct 16, 2009 at 8:41 AM, Holger Schurig
<hs4233@xxxxxxxxxxxxxxxxxxxx> wrote:
> Andrey, can you fix this?  I don't have SPI hardware and wouldn't
> be able to check the functionality after the fixes. However, some
> things are obvious, e.g.
>
>
> u16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK);
>
> should either be
>
>  reg_out = reg | IF_SPI_WRITE_OPERATION_MASK;
>
> or
>
>  __le16 reg_out = cpu_to_le16(reg | IF_SPI_WRITE_OPERATION_MASK);

It used to be as per your first suggestion but Sebastian changed it to
the current version in commit f488b72d (he was using a PowerPC-based
SoC and was thus on a BE architecture vs. our LE systems, so it was a
good catch).  Changing it to be a __le16 sounds reasonable.  Are you
in a position to go ahead and make these changes and have me quickly
test your patch (on LE hardware though, unless Sebastian can chime in
and help us)?  I have time to apply and test a patch but unfortunately
I don't have time to nail down all of the sparse warnings you posted
this week.

> Here's a run with sparse:
>
> $ make -C /usr/src/linux-wl/ modules SUBDIRS=drivers/net/wireless/libertas C=2 CF=-D__CHECK_ENDIAN__
> drivers/net/wireless/libertas/if_spi.c:137:16: warning: incorrect type in initializer (different base types)
> drivers/net/wireless/libertas/if_spi.c:137:16:    expected unsigned short [unsigned] [usertype] reg_out
> drivers/net/wireless/libertas/if_spi.c:137:16:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:191:16: warning: incorrect type in initializer (different base types)
> drivers/net/wireless/libertas/if_spi.c:191:16:    expected unsigned short [unsigned] [usertype] reg_out
> drivers/net/wireless/libertas/if_spi.c:191:16:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:256:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:256:24:    expected restricted __le32 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:256:24:    got unsigned int *<noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:171:7: warning: incorrect type in assignment (different base types)
> drivers/net/wireless/libertas/if_spi.c:171:7:    expected unsigned short [unsigned] [usertype] buff
> drivers/net/wireless/libertas/if_spi.c:171:7:    got restricted __le16 [usertype] <noident>
> drivers/net/wireless/libertas/if_spi.c:243:24: warning: incorrect type in argument 1 (different base types)
> drivers/net/wireless/libertas/if_spi.c:243:24:    expected restricted __le16 const [usertype] *p
> drivers/net/wireless/libertas/if_spi.c:243:24:    got unsigned short *<noident>
> --
> http://www.holgerschurig.de
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux