wifi: wilc1000: set station_info flag only when signal value is valid
authorAjay Singh <ajay.kathat@microchip.com>
Wed, 20 Jul 2022 16:03:04 +0000 (16:03 +0000)
committerKalle Valo <kvalo@kernel.org>
Wed, 27 Jul 2022 12:58:10 +0000 (15:58 +0300)
Set station_info->filled to indicate signal level only when its value is
received successfully using wilc_get_rssi().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220720160302.231516-4-ajay.kathat@microchip.com
drivers/net/wireless/microchip/wilc1000/cfg80211.c

index 5c2c7f1..3ac373d 100644 (file)
@@ -1312,12 +1312,11 @@ static int dump_station(struct wiphy *wiphy, struct net_device *dev,
        if (idx != 0)
                return -ENOENT;
 
-       sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
-
        ret = wilc_get_rssi(vif, &sinfo->signal);
        if (ret)
                return ret;
 
+       sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
        memcpy(mac, vif->priv.associated_bss, ETH_ALEN);
        return 0;
 }