]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: wcn36xx: buff_to_be(): fix sparse warnings
authorKalle Valo <quic_kvalo@quicinc.com>
Wed, 20 Mar 2024 18:24:47 +0000 (20:24 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Mon, 25 Mar 2024 10:50:41 +0000 (12:50 +0200)
Sparse warns:

drivers/net/wireless/ath/wcn36xx/txrx.c: note: in included file (through drivers/net/wireless/ath/wcn36xx/txrx.h):
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    expected unsigned int [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    got restricted __be32 [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types)
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    expected unsigned int [usertype]
drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24:    got restricted __be32 [usertype]

Use void pointers and two separate variables to workaround the warning. Also
now the callers don't need any casting. There's actually cpu_to_be32_array()
available but decided to do minimal changes instead.

Compile tested only.

Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240320182449.3757215-3-kvalo@kernel.org
drivers/net/wireless/ath/wcn36xx/txrx.c
drivers/net/wireless/ath/wcn36xx/wcn36xx.h

index 0802ed728824948e7278f622cbdce06e12f97c62..8826998797d678d8e90225204a12c738423bd625 100644 (file)
@@ -318,7 +318,7 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb)
        memset(&status, 0, sizeof(status));
 
        bd = (struct wcn36xx_rx_bd *)skb->data;
-       buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32));
+       buff_to_be(bd, sizeof(*bd)/sizeof(u32));
        wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP,
                         "BD   <<< ", (char *)bd,
                         sizeof(struct wcn36xx_rx_bd));
@@ -692,7 +692,7 @@ int wcn36xx_start_tx(struct wcn36xx *wcn,
                /* MGMT and CTRL frames are handeld here*/
                wcn36xx_set_tx_mgmt(&bd, wcn, &vif_priv, skb, bcast);
 
-       buff_to_be((u32 *)&bd, sizeof(bd)/sizeof(u32));
+       buff_to_be(&bd, sizeof(bd)/sizeof(u32));
        bd.tx_bd_sign = 0xbdbdbdbd;
 
        ret = wcn36xx_dxe_tx_frame(wcn, vif_priv, &bd, skb, is_low);
index ff4a8e5d72091f057136cdee1ebaaa3b9e8fb2df..bccc27de848da568a1534e13b7a41bb10929f6f6 100644 (file)
@@ -100,11 +100,14 @@ enum wcn36xx_ampdu_state {
 #define RF_IRIS_WCN3660        0x3660
 #define RF_IRIS_WCN3680        0x3680
 
-static inline void buff_to_be(u32 *buf, size_t len)
+static inline void buff_to_be(void *buf, size_t len)
 {
+       __be32 *to = buf;
+       u32 *from = buf;
        int i;
+
        for (i = 0; i < len; i++)
-               buf[i] = cpu_to_be32(buf[i]);
+               to[i] = cpu_to_be32(from[i]);
 }
 
 struct nv_data {