sparse warning about endianness mismatch on 0xffff assignment

From: Sathya Perla
Date: Thu Apr 16 2015 - 02:05:32 EST


Hi,

The following code causes a sparse warning about " incorrect type in assignment (different base types)"

__le16 var = 0xFFFF;


What would be the best way of fixing this warning?

a) __le16 var = cpu_to_le16(0xFFFF);
b) __le16 var = (__force __le16) 0xFFFF;
c) Ignore the warning and/or fix the sparse tool to not warn about endianness mismatch on an "all 1s" assignment

thanks,
-Sathya




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/