Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning

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

 



On 20/04/15 05:24, Dan Carpenter wrote:
> Mk16_le() is a bad function name and as we can see from tkip.c it just
> duplicates get_unaligned_le16().  Better to make TK void pointer instead
> of a u8 pointer (because it doesn't point to u8s so we have to cast it
> every time we use it).  This is another trick I learned from tkip.c.
Ok. Could I just remove Mk16_le() and use get_unaligned_le16() instead?

I built rtl8192u/ using get_unaligned_le16() for the following lines and
I didn't get any warning:

+#include <asm/unaligned.h>

-    PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0]));
-    PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0]));
-    PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2]));
-    PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4]));
-    PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6]));
-    PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8]));
-    PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10]));
-
-    PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12]));
-    PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14]));
+    PPK[0] += _S_(PPK[5] ^ get_unaligned_le16(TK + 0));
+    PPK[1] += _S_(PPK[0] ^ get_unaligned_le16(TK + 2));
+    PPK[2] += _S_(PPK[1] ^ get_unaligned_le16(TK + 4));
+    PPK[3] += _S_(PPK[2] ^ get_unaligned_le16(TK + 6));
+    PPK[4] += _S_(PPK[3] ^ get_unaligned_le16(TK + 8));
+    PPK[5] += _S_(PPK[4] ^ get_unaligned_le16(TK + 10));
+
+    PPK[0] += RotR1(PPK[5] ^ get_unaligned_le16(TK + 12));
+    PPK[1] += RotR1(PPK[0] ^ get_unaligned_le16(TK + 14));


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux