From: Luciano Coelho Date: Mon, 18 Jun 2012 12:52:51 +0000 (+0300) Subject: mac80211: initialize sta pointer to avoid false-positive warning X-Git-Tag: v3.6-rc1~125^2~57^2~248^2~13 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6df653c71e8168e1df01118cc85cd84d0deeb583;p=pandora-kernel.git mac80211: initialize sta pointer to avoid false-positive warning Some compilers (eg. gcc 4.4.1 for ARM) report a false positive warning in mlme.c: net/mac80211/mlme.c: In function 'ieee80211_prep_connection': net/mac80211/mlme.c:3035: warning: 'sta' may be used uninitialized in this function This is a false positive because the place where 'sta' is used is inside an if with the same condition of where it is set: [...] if (!have_sta) { sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); if (!sta) return -ENOMEM; } [...] if (!have_sta) { [...] sta->sta.supp_rates[cbss->channel->band] = rates; [...] For some reason the compiler doesn't understand this and warns. While this is not a problem in the code itself, we can avoid polluting the build logs with false positives by setting sta to NULL on declaration and checking for sta instead of !have_sta in the second if. Reported-by: Tony Lindgren Signed-off-by: Luciano Coelho Signed-off-by: Johannes Berg --- Reading git-diff-tree failed