diff options
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r-- | net/wireless/wext-compat.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 9e002df0f8d8..05186a47878f 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -1254,7 +1254,7 @@ static int cfg80211_wext_giwrate(struct net_device *dev, | |||
1254 | { | 1254 | { |
1255 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 1255 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
1256 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); | 1256 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
1257 | struct station_info *sinfo; | 1257 | struct station_info sinfo = {}; |
1258 | u8 addr[ETH_ALEN]; | 1258 | u8 addr[ETH_ALEN]; |
1259 | int err; | 1259 | int err; |
1260 | 1260 | ||
@@ -1274,23 +1274,16 @@ static int cfg80211_wext_giwrate(struct net_device *dev, | |||
1274 | if (err) | 1274 | if (err) |
1275 | return err; | 1275 | return err; |
1276 | 1276 | ||
1277 | sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); | 1277 | err = rdev_get_station(rdev, dev, addr, &sinfo); |
1278 | if (!sinfo) | ||
1279 | return -ENOMEM; | ||
1280 | |||
1281 | err = rdev_get_station(rdev, dev, addr, sinfo); | ||
1282 | if (err) | 1278 | if (err) |
1283 | goto out; | 1279 | return err; |
1284 | 1280 | ||
1285 | if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) { | 1281 | if (!(sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))) |
1286 | err = -EOPNOTSUPP; | 1282 | return -EOPNOTSUPP; |
1287 | goto out; | ||
1288 | } | ||
1289 | 1283 | ||
1290 | rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo->txrate); | 1284 | rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); |
1291 | out: | 1285 | |
1292 | kfree(sinfo); | 1286 | return 0; |
1293 | return err; | ||
1294 | } | 1287 | } |
1295 | 1288 | ||
1296 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ | 1289 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ |