mac80211: avoid "uninitialised variable" warning
PATCH 1/1 mac80211: avoid "uninitialised variable" warning
gcc is not able to correlate chan_pwr and have_chan_pwr in ieee80211_handle_pwr_constr(), therefore it throws a warning about chan_pwr being potentially used uninitialised even if this is not true.
However, initialise chan_pwr to 0 to silent the warning.
Signed-off-by Antonio Quartulli <[email protected]>
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -1146,7 +1146,7 @@ static u32 ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, {struct ieee80211_country_ie_triplet *triplet;int chan =ieee80211_frequency_to_channel (channel->center_freq); -int i, chan_pwr, chan_increment, new_ap_level; +int i, chan_pwr =0 , chan_increment, new_ap_level;bool have_chan_pwr = false;/* Invalid IE */
Signature · 1 line
1.8.5.5
Johannes Berg
maintainerQuoted 6 lines · Antonio Quartulli
gcc is not able to correlate
chan_pwrandhave_chan_pwrinieee80211_handle_pwr_constr(), therefore it throws a warning aboutchan_pwrbeing potentially used uninitialised even if this is not true.However, initialise
chan_pwrto 0 to silent the warning.
I don't see any warnings (even with -Wmaybe-uninitialized added manually) and don't like gratuitous initializations, so I'll drop this.
johannes