Skip to contentSkip to conversation

staging: rtl8723au: Fix sparse warning: cast to restricted __le16

PATCH In review Johannes Postma 2 participants 5 messages Aug 6, 2015 – Aug 7, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723au: Fix sparse warning: cast to restricted __le16

usPtr is used as __le16 *, but was defined as u16 *.
This was reported by sparse as:
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1850:29: warning: cast to restricted __le16

This patch fixes the type of usPtr.

---
 drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +1 -1
index cb5076a..eb76ac4 100644
@@ -1838,7 +1838,7 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter,
 
 static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc)
 {
-	u16 *usPtr = (u16 *) ptxdesc;
+	__le16 *usPtr = (__le16 *)ptxdesc;
 	u32 count = 16;		/*  (32 bytes / 2 bytes per XOR) => 16 times */
 	u32 index;
 	u16 checksum = 0;
Signature · 1 line
2.5.0
#1 lore raw
Quoted 11 lines · Johannes Postma

usPtr is used as __le16 *, but was defined as u16 *.
This was reported by sparse as:
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c:1850:29: warning: cast to restricted __le16

This patch fixes the type of usPtr.

---
 drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Looks OK to me. Probably worth changing the *(usPtr + index) to be usPtr[index] as well to make the code easier to read.

Jes

Quoted 13 lines
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +1 -1
index cb5076a..eb76ac4 100644
@@ -1838,7 +1838,7 @@ Hal_EfuseParseThermalMeter_8723A(struct rtw_adapter *padapter,
 
 static void rtl8723a_cal_txdesc_chksum(struct tx_desc *ptxdesc)
 {
-	u16 *usPtr = (u16 *) ptxdesc;
+	__le16 *usPtr = (__le16 *)ptxdesc;
 	u32 count = 16;		/*  (32 bytes / 2 bytes per XOR) => 16 times */
 	u32 index;
 	u16 checksum = 0;
#2 lore raw
Quoted 6 lines · Jes Sorensen

Looks OK to me. Probably worth changing the *(usPtr + index) to be usPtr[index] as well to make the code easier to read.

Jes

Thank you for reviewing. I will make a seperate patch for that. I will send it after this one is accepted. Or should I combine them into a patch serie?

Johannes

#3 lore raw
Quoted 11 lines · Johannes Postma
Quoted 6 lines · Jes Sorensen

Looks OK to me. Probably worth changing the *(usPtr + index) to be usPtr[index] as well to make the code easier to read.

Jes

Thank you for reviewing. I will make a seperate patch for that. I will send it after this one is accepted. Or should I combine them into a patch serie?

Either is fine with me.

Jes

#4 lore raw
Quoted 9 lines · Jes Sorensen
Quoted 8 lines · Johannes Postma
Quoted 6 lines · Jes Sorensen

Looks OK to me. Probably worth changing the *(usPtr + index) to be usPtr[index] as well to make the code easier to read.

Jes

Quoted 7 lines
Quoted 3 lines

Thank you for reviewing. I will make a seperate patch for that. I will send it after this one is accepted. Or should I combine them into a patch serie?

Either is fine with me.

Jes

Ok, I have sent it as a separate patch. Since it doesn't depend on this patch and should apply cleanly I have already sent it in.

Johannes