mwifiex: code rearrangement for better readability
authorAmitkumar Karwar <akarwar@marvell.com>
Tue, 18 Jun 2013 23:36:56 +0000 (16:36 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 19 Jun 2013 19:28:20 +0000 (15:28 -0400)
Use negative check (if(!bss_desc)) and return failure
instead of failing a NULL check later in
mwifiex_check_network_compatibility() routine.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/sta_ioctl.c

index 23aa910bc5d0c1691a5bf8354881083f98ecd138..15b5457fa4e5d7e5d1a5ca59f86c0659341ea1e4 100644 (file)
@@ -255,25 +255,24 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
        }
 
        if (priv->bss_mode == NL80211_IFTYPE_STATION) {
+               u8 config_bands;
+
                /* Infra mode */
                ret = mwifiex_deauthenticate(priv, NULL);
                if (ret)
                        goto done;
 
-               if (bss_desc) {
-                       u8 config_bands = 0;
+               if (!bss_desc)
+                       return -1;
 
-                       if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band)
-                           == HostCmd_SCAN_RADIO_TYPE_BG)
-                               config_bands = BAND_B | BAND_G | BAND_GN |
-                                              BAND_GAC;
-                       else
-                               config_bands = BAND_A | BAND_AN | BAND_AAC;
+               if (mwifiex_band_to_radio_type(bss_desc->bss_band) ==
+                                               HostCmd_SCAN_RADIO_TYPE_BG)
+                       config_bands = BAND_B | BAND_G | BAND_GN | BAND_GAC;
+               else
+                       config_bands = BAND_A | BAND_AN | BAND_AAC;
 
-                       if (!((config_bands | adapter->fw_bands) &
-                             ~adapter->fw_bands))
-                               adapter->config_bands = config_bands;
-               }
+               if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands))
+                       adapter->config_bands = config_bands;
 
                ret = mwifiex_check_network_compatibility(priv, bss_desc);
                if (ret)