diff options
author | Johannes Berg <johannes.berg@intel.com> | 2018-05-18 09:57:55 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2018-05-18 11:14:35 +0200 |
commit | 73887fd906bb77a974fa02663df9937d0aff053a (patch) | |
tree | 9f2301560feb727cca41cb72fd8848dc302b7392 /net/wireless/wext-compat.c | |
parent | cfg80211: dynamically allocate per-tid stats for station info (diff) | |
download | linux-73887fd906bb77a974fa02663df9937d0aff053a.tar.xz linux-73887fd906bb77a974fa02663df9937d0aff053a.zip |
cfg80211/mac80211: revert to stack allocation for sinfo
Arend's previous patch made the sinfo structure smaller
again by to dynamically allocating the per-tid stats
only when needed. Thus, revert to stack allocation for
the struct to simplify the code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to '')
-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, { struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); - struct station_info *sinfo; + struct station_info sinfo = {}; u8 addr[ETH_ALEN]; int err; @@ -1274,23 +1274,16 @@ static int cfg80211_wext_giwrate(struct net_device *dev, if (err) return err; - sinfo = kzalloc(sizeof(*sinfo), GFP_KERNEL); - if (!sinfo) - return -ENOMEM; - - err = rdev_get_station(rdev, dev, addr, sinfo); + err = rdev_get_station(rdev, dev, addr, &sinfo); if (err) - goto out; + return err; - if (!(sinfo->filled & BIT(NL80211_STA_INFO_TX_BITRATE))) { - err = -EOPNOTSUPP; - goto out; - } + if (!(sinfo.filled & BIT(NL80211_STA_INFO_TX_BITRATE))) + return -EOPNOTSUPP; - rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo->txrate); -out: - kfree(sinfo); - return err; + rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); + + return 0; } /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ |