Skip to contentSkip to conversation

wifi: ath12k: last element unused?

bug report Dan Carpenter 1 participant 1 message Feb 16, 2023 Qualcomm ATH12K wireless driver

lore
Share & tools
lore
#0 lore raw

Hello Kalle Valo,

The patch d889913205cf: "wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices" from Nov 28, 2022, leads to the following Smatch static checker warning:

	drivers/net/wireless/ath/ath12k/dp_rx.c:1172 ath12k_get_ppdu_user_index()
	warn: why is the last element skipped?

drivers/net/wireless/ath/ath12k/dp_rx.c

    1167 static int ath12k_get_ppdu_user_index(struct htt_ppdu_stats *ppdu_stats,
    1168                                       u16 peer_id)
    1169 {
    1170         int i;
    1171 

--> 1172 for (i = 0; i < HTT_PPDU_STATS_MAX_USERS - 1; i++) {

What's the - 1 for? The "HTT_PPDU_STATS_MAX_USERS - 1" is done in several places so maybe it's correct but I couldn't figure out what's stored in the last element of the array.

    1173                 if (ppdu_stats->user_stats[i].is_valid_peer_id) {
    1174                         if (peer_id == ppdu_stats->user_stats[i].peer_id)
    1175                                 return i;
    1176                 } else {
    1177                         return i;
    1178                 }
    1179         }
    1180 
    1181         return -EINVAL;
    1182 }

regards,
dan carpenter

Signature · 3 lines
ath12k mailing list
[email protected]
https://lists.infradead.org/mailman/listinfo/ath12k