Skip to contentSkip to conversation

staging: rtl8712: Fix sparse warnings about endianness

PATCH NAK maomao xu 2 participants 2 messages Feb 15, 2017 Staging

lore
Share & tools
lore

maomao xu

author
#0 lore raw

PATCH 1/1 staging: rtl8712: Fix sparse warnings about endianness

drivers/staging/rtl8712/rtl871x_xmit.c:350:44: warning: restricted __le32 degrades to integer

drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
index 4ab82ba..1c2ac28 100644
@@ -347,7 +347,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	 * some settings above.
 	 */
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
-		pattrib->priority = (txdesc.txdw1 >> QSEL_SHT) & 0x1f;
+		pattrib->priority = (le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f;
 	return _SUCCESS;
 }
 
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 4 lines · maomao xu

drivers/staging/rtl8712/rtl871x_xmit.c:350:44: warning: restricted __le32 degrades to integer

You are using the wrong tree. In the staging-next branch of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git, there is a patch

commit 07222e535831b916221dd2a48a3047ec7e45dc72

Author: Larry Finger <[email protected]>
Date:   Fri Feb 10 21:30:27 2017 -0600

staging: r8712u: Fix Sparse warning in rtl871x_xmit.c

that already makes that fix. In fact, all the endian issues in that driver are resolved. When the compilers were changed to include endian issues with all Sparse checks, we started getting patches that silenced the warnings, but broke the driver on big-endian hardware. For that reason, I generate the set of patches that fixed all of them and tested on a BE laptop that I keep just for that purpose.

NACK.

Larry

Quoted 14 lines
drivers/staging/rtl8712/rtl871x_xmit.c +1 -1
index 4ab82ba..1c2ac28 100644
@@ -347,7 +347,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt,
 	 * some settings above.
 	 */
 	if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
-		pattrib->priority = (txdesc.txdw1 >> QSEL_SHT) & 0x1f;
+		pattrib->priority = (le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f;
 	return _SUCCESS;
 }