ath10k: Fix suspicious RCU usage warning in ath10k_wmi_tlv_parse_peer_stats_info()
[linux-2.6-microblaze.git] / drivers / net / wireless / ath / ath10k / wmi-tlv.c
index 7b58341..bfdd017 100644 (file)
@@ -93,7 +93,7 @@ ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len,
 
                if (tlv_len > len) {
                        ath10k_dbg(ar, ATH10K_DBG_WMI,
-                                  "wmi tlv parse failure of tag %hhu at byte %zd (%zu bytes left, %hhu expected)\n",
+                                  "wmi tlv parse failure of tag %u at byte %zd (%zu bytes left, %u expected)\n",
                                   tlv_tag, ptr - begin, len, tlv_len);
                        return -EINVAL;
                }
@@ -102,7 +102,7 @@ ath10k_wmi_tlv_iter(struct ath10k *ar, const void *ptr, size_t len,
                    wmi_tlv_policies[tlv_tag].min_len &&
                    wmi_tlv_policies[tlv_tag].min_len > tlv_len) {
                        ath10k_dbg(ar, ATH10K_DBG_WMI,
-                                  "wmi tlv parse failure of tag %hhu at byte %zd (%hhu bytes is less than min length %zu)\n",
+                                  "wmi tlv parse failure of tag %u at byte %zd (%u bytes is less than min length %zu)\n",
                                   tlv_tag, ptr - begin, tlv_len,
                                   wmi_tlv_policies[tlv_tag].min_len);
                        return -EINVAL;
@@ -240,8 +240,10 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16
                   __le32_to_cpu(stat->last_tx_rate_code),
                   __le32_to_cpu(stat->last_tx_bitrate_kbps));
 
+       rcu_read_lock();
        sta = ieee80211_find_sta_by_ifaddr(ar->hw, stat->peer_macaddr.addr, NULL);
        if (!sta) {
+               rcu_read_unlock();
                ath10k_warn(ar, "not found station for peer stats\n");
                return -EINVAL;
        }
@@ -251,6 +253,7 @@ static int ath10k_wmi_tlv_parse_peer_stats_info(struct ath10k *ar, u16 tag, u16
        arsta->rx_bitrate_kbps = __le32_to_cpu(stat->last_rx_bitrate_kbps);
        arsta->tx_rate_code = __le32_to_cpu(stat->last_tx_rate_code);
        arsta->tx_bitrate_kbps = __le32_to_cpu(stat->last_tx_bitrate_kbps);
+       rcu_read_unlock();
 
        return 0;
 }
@@ -421,7 +424,7 @@ static int ath10k_wmi_tlv_event_p2p_noa(struct ath10k *ar,
        vdev_id = __le32_to_cpu(ev->vdev_id);
 
        ath10k_dbg(ar, ATH10K_DBG_WMI,
-                  "wmi tlv p2p noa vdev_id %i descriptors %hhu\n",
+                  "wmi tlv p2p noa vdev_id %i descriptors %u\n",
                   vdev_id, noa->num_descriptors);
 
        ath10k_p2p_noa_update_by_vdev_id(ar, vdev_id, noa);