]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
cfg80211: avoid using default in interface type switch
authorJohannes Berg <johannes.berg@intel.com>
Fri, 31 Oct 2014 13:16:12 +0000 (14:16 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 31 Oct 2014 13:19:19 +0000 (14:19 +0100)
Most code avoids having a default case in interface type switch
statements already, to make it easier to find places that need
to be extended. Change the code in the __cfg80211_leave() and
nl80211_key_allowed() functions to not have a default case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/nl80211.c

index 87bb502bc8deff94128d1782d101874342c18e77..da4dcb65ade433d9230e84be0e0419f239487111 100644 (file)
@@ -869,7 +869,19 @@ void __cfg80211_leave(struct cfg80211_registered_device *rdev,
        case NL80211_IFTYPE_P2P_GO:
                __cfg80211_stop_ap(rdev, dev, true);
                break;
-       default:
+       case NL80211_IFTYPE_WDS:
+               /* must be handled by mac80211/driver, has no APIs */
+               break;
+       case NL80211_IFTYPE_P2P_DEVICE:
+               /* cannot happen, has no netdev */
+               break;
+       case NL80211_IFTYPE_AP_VLAN:
+       case NL80211_IFTYPE_MONITOR:
+               /* nothing to do */
+               break;
+       case NL80211_IFTYPE_UNSPECIFIED:
+       case NUM_NL80211_IFTYPES:
+               /* invalid */
                break;
        }
 }
index 33aff7466f2ff36d42f5ce77c80595543b7e426d..f7d918858d32863b461d343a9e40bff5907db3d8 100644 (file)
@@ -884,7 +884,11 @@ static int nl80211_key_allowed(struct wireless_dev *wdev)
                if (!wdev->current_bss)
                        return -ENOLINK;
                break;
-       default:
+       case NL80211_IFTYPE_UNSPECIFIED:
+       case NL80211_IFTYPE_MONITOR:
+       case NL80211_IFTYPE_P2P_DEVICE:
+       case NL80211_IFTYPE_WDS:
+       case NUM_NL80211_IFTYPES:
                return -EINVAL;
        }