summaryrefslogtreecommitdiffstats
path: root/net/batman-adv/bat_v_elp.c
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2019-02-22 16:25:54 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-08 07:21:46 +0200
commit894b4fc04387e4fc3ccbc63788c3feb5ae2b3cbc (patch)
treeec3cf48257a1424268d2ab051e2bba33742fb092 /net/batman-adv/bat_v_elp.c
parent7afe374cc718ec94f33ad22f331ce751abdaaff9 (diff)
downloadlinux-stable-894b4fc04387e4fc3ccbc63788c3feb5ae2b3cbc.tar.gz
linux-stable-894b4fc04387e4fc3ccbc63788c3feb5ae2b3cbc.tar.bz2
linux-stable-894b4fc04387e4fc3ccbc63788c3feb5ae2b3cbc.zip
batman-adv: fix warning in function batadv_v_elp_get_throughput
[ Upstream commit ca8c3b922e7032aff6cc3fd05548f4df1f3df90e ] When CONFIG_CFG80211 isn't enabled the compiler correcly warns about 'sinfo.pertid' may be unused. It can also happen for other error conditions that it not warn about. net/batman-adv/bat_v_elp.c: In function ‘batadv_v_elp_get_throughput.isra.0’: include/net/cfg80211.h:6370:13: warning: ‘sinfo.pertid’ may be used uninitialized in this function [-Wmaybe-uninitialized] kfree(sinfo->pertid); ~~~~~^~~~~~~~ Rework so that we only release '&sinfo' if cfg80211_get_station returns zero. Fixes: 7d652669b61d ("batman-adv: release station info tidstats") Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/batman-adv/bat_v_elp.c')
-rw-r--r--net/batman-adv/bat_v_elp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c
index ef0dec20c7d8..5da183b2f4c9 100644
--- a/net/batman-adv/bat_v_elp.c
+++ b/net/batman-adv/bat_v_elp.c
@@ -104,8 +104,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh)
ret = cfg80211_get_station(real_netdev, neigh->addr, &sinfo);
- /* free the TID stats immediately */
- cfg80211_sinfo_release_content(&sinfo);
+ if (!ret) {
+ /* free the TID stats immediately */
+ cfg80211_sinfo_release_content(&sinfo);
+ }
dev_put(real_netdev);
if (ret == -ENOENT) {