Add default case in switch statement
Joe Korty [Wed, 25 May 2016 12:57:27 +0000 (17:57 +0530)]
Provide a reasonable default value
(ie, the original value) for smps_mode
when a new value is not being assigned.

This forces the value of 'changed' to be correct
when no attempt at changing is being done to
'smps_mode'.

net/mac80211/ht.c: In function
'ieee80211_ht_cap_ie_to_sta_ht_cap':
net/mac80211/ht.c:232:5: warning:
'smps_mode' may be used uninitialized in this
function [-Wmaybe-uninitialized]
if (smps_mode != sta->sta.smps_mode)

Bug 200187768

Change-Id: Ife7dbe09e911d801c4fc1e85c3f8ad40cd681c09
Signed-off-by: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Gaurav Singh <gaursingh@nvidia.com>
Reviewed-on: http://git-master/r/1163941
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>

net/mac80211/ht.c

index af8cee0..51c7dba 100644 (file)
@@ -227,6 +227,8 @@ bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
        case WLAN_HT_CAP_SM_PS_DISABLED:
                smps_mode = IEEE80211_SMPS_OFF;
                break;
+       default:
+               smps_mode = sta->sta.smps_mode;
        }
 
        if (smps_mode != sta->sta.smps_mode)