Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cff23cec authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville
Browse files

mwifiex: fix checkpatch --strict warnings/errors Part 5



For file scan.c

Signed-off-by: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f57c1edc
Loading
Loading
Loading
Loading
+170 −173
Original line number Original line Diff line number Diff line
@@ -148,8 +148,9 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
	struct ie_body *iebody;
	struct ie_body *iebody;
	u8 ret = MWIFIEX_OUI_NOT_PRESENT;
	u8 ret = MWIFIEX_OUI_NOT_PRESENT;


	if (((bss_desc->bcn_wpa_ie) && ((*(bss_desc->bcn_wpa_ie)).
	if (((bss_desc->bcn_wpa_ie) &&
				      vend_hdr.element_id == WLAN_EID_WPA))) {
	     ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id ==
	      WLAN_EID_WPA))) {
		iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data;
		iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data;
		oui = &mwifiex_wpa_oui[cipher][0];
		oui = &mwifiex_wpa_oui[cipher][0];
		ret = mwifiex_search_oui_in_ie(iebody, oui);
		ret = mwifiex_search_oui_in_ie(iebody, oui);
@@ -175,7 +176,7 @@ mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2)
 * compatible with it.
 * compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_wapi(struct mwifiex_private *priv,
mwifiex_is_bss_wapi(struct mwifiex_private *priv,
		    struct mwifiex_bssdescriptor *bss_desc)
		    struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (priv->sec_info.wapi_enabled &&
	if (priv->sec_info.wapi_enabled &&
@@ -192,18 +193,17 @@ mwifiex_is_network_compatible_for_wapi(struct mwifiex_private *priv,
 * scanned network is compatible with it.
 * scanned network is compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv,
mwifiex_is_bss_no_sec(struct mwifiex_private *priv,
		      struct mwifiex_bssdescriptor *bss_desc)
		      struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	    !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
	    !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
		((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id !=
		((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id !=
	    WLAN_EID_WPA))
		 WLAN_EID_WPA)) &&
	    && ((!bss_desc->bcn_rsn_ie) ||
	    ((!bss_desc->bcn_rsn_ie) ||
		((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id !=
		((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id !=
	    WLAN_EID_RSN))
		 WLAN_EID_RSN)) &&
	    && !priv->sec_info.encryption_mode
	    !priv->sec_info.encryption_mode && !bss_desc->privacy) {
	    && !bss_desc->privacy) {
		return true;
		return true;
	}
	}
	return false;
	return false;
@@ -214,7 +214,7 @@ mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv,
 * is compatible with it.
 * is compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv,
mwifiex_is_bss_static_wep(struct mwifiex_private *priv,
			  struct mwifiex_bssdescriptor *bss_desc)
			  struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
@@ -229,7 +229,7 @@ mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv,
 * compatible with it.
 * compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv,
mwifiex_is_bss_wpa(struct mwifiex_private *priv,
		   struct mwifiex_bssdescriptor *bss_desc)
		   struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
	if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
@@ -264,17 +264,18 @@ mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv,
 * compatible with it.
 * compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv,
mwifiex_is_bss_wpa2(struct mwifiex_private *priv,
		    struct mwifiex_bssdescriptor *bss_desc)
		    struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	if (!priv->sec_info.wep_enabled &&
	    priv->sec_info.wpa2_enabled && ((bss_desc->bcn_rsn_ie) &&
	    !priv->sec_info.wpa_enabled &&
	    ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))
	    priv->sec_info.wpa2_enabled &&
	    ((bss_desc->bcn_rsn_ie) &&
	     ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))) {
		/*
		/*
		 * Privacy bit may NOT be set in some APs like
		 * Privacy bit may NOT be set in some APs like
		 * LinkSys WRT54G && bss_desc->privacy
		 * LinkSys WRT54G && bss_desc->privacy
		 */
		 */
	 ) {
		dev_dbg(priv->adapter->dev, "info: %s: WPA2: "
		dev_dbg(priv->adapter->dev, "info: %s: WPA2: "
			" wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
			" wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
			"EncMode=%#x privacy=%#x\n", __func__,
			"EncMode=%#x privacy=%#x\n", __func__,
@@ -299,16 +300,16 @@ mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv,
 * compatible with it.
 * compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv,
mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv,
			 struct mwifiex_bssdescriptor *bss_desc)
			 struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	    !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
	    !priv->sec_info.wpa2_enabled &&
	    ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA))
	    ((!bss_desc->bcn_wpa_ie) ||
	    && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.
	     ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) &&
		   element_id != WLAN_EID_RSN))
	    ((!bss_desc->bcn_rsn_ie) ||
	    && !priv->sec_info.encryption_mode
	     ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
	    && bss_desc->privacy) {
	    !priv->sec_info.encryption_mode && bss_desc->privacy) {
		return true;
		return true;
	}
	}
	return false;
	return false;
@@ -319,16 +320,16 @@ mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv,
 * is compatible with it.
 * is compatible with it.
 */
 */
static bool
static bool
mwifiex_is_network_compatible_for_dynamic_wep(struct mwifiex_private *priv,
mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv,
			   struct mwifiex_bssdescriptor *bss_desc)
			   struct mwifiex_bssdescriptor *bss_desc)
{
{
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
	    !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
	    !priv->sec_info.wpa2_enabled &&
	    ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA))
	    ((!bss_desc->bcn_wpa_ie) ||
	    && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.
	     ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) &&
		   element_id != WLAN_EID_RSN))
	    ((!bss_desc->bcn_rsn_ie) ||
	    && priv->sec_info.encryption_mode
	     ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
	    && bss_desc->privacy) {
	    priv->sec_info.encryption_mode && bss_desc->privacy) {
		dev_dbg(priv->adapter->dev, "info: %s: dynamic "
		dev_dbg(priv->adapter->dev, "info: %s: dynamic "
			"WEP: wpa_ie=%#x wpa2_ie=%#x "
			"WEP: wpa_ie=%#x wpa2_ie=%#x "
			"EncMode=%#x privacy=%#x\n",
			"EncMode=%#x privacy=%#x\n",
@@ -373,8 +374,9 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
	bss_desc->disable_11n = false;
	bss_desc->disable_11n = false;


	/* Don't check for compatibility if roaming */
	/* Don't check for compatibility if roaming */
	if (priv->media_connected && (priv->bss_mode == NL80211_IFTYPE_STATION)
	if (priv->media_connected &&
	    && (bss_desc->bss_mode == NL80211_IFTYPE_STATION))
	    (priv->bss_mode == NL80211_IFTYPE_STATION) &&
	    (bss_desc->bss_mode == NL80211_IFTYPE_STATION))
		return 0;
		return 0;


	if (priv->wps.session_enable) {
	if (priv->wps.session_enable) {
@@ -383,32 +385,30 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
		return 0;
		return 0;
	}
	}


	if (mwifiex_is_network_compatible_for_wapi(priv, bss_desc)) {
	if (mwifiex_is_bss_wapi(priv, bss_desc)) {
		dev_dbg(adapter->dev, "info: return success for WAPI AP\n");
		dev_dbg(adapter->dev, "info: return success for WAPI AP\n");
		return 0;
		return 0;
	}
	}


	if (bss_desc->bss_mode == mode) {
	if (bss_desc->bss_mode == mode) {
		if (mwifiex_is_network_compatible_for_no_sec(priv, bss_desc)) {
		if (mwifiex_is_bss_no_sec(priv, bss_desc)) {
			/* No security */
			/* No security */
			return 0;
			return 0;
		} else if (mwifiex_is_network_compatible_for_static_wep(priv,
		} else if (mwifiex_is_bss_static_wep(priv, bss_desc)) {
								bss_desc)) {
			/* Static WEP enabled */
			/* Static WEP enabled */
			dev_dbg(adapter->dev, "info: Disable 11n in WEP mode.\n");
			dev_dbg(adapter->dev, "info: Disable 11n in WEP mode.\n");
			bss_desc->disable_11n = true;
			bss_desc->disable_11n = true;
			return 0;
			return 0;
		} else if (mwifiex_is_network_compatible_for_wpa(priv,
		} else if (mwifiex_is_bss_wpa(priv, bss_desc)) {
								 bss_desc)) {
			/* WPA enabled */
			/* WPA enabled */
			if (((priv->adapter->config_bands & BAND_GN
			if (((priv->adapter->config_bands & BAND_GN ||
			      || priv->adapter->config_bands & BAND_AN)
			      priv->adapter->config_bands & BAND_AN) &&
			      && bss_desc->bcn_ht_cap)
			     bss_desc->bcn_ht_cap) &&
			      && !mwifiex_is_wpa_oui_present(bss_desc,
			    !mwifiex_is_wpa_oui_present(bss_desc,
							 CIPHER_SUITE_CCMP)) {
							 CIPHER_SUITE_CCMP)) {


				if (mwifiex_is_wpa_oui_present(bss_desc,
				if (mwifiex_is_wpa_oui_present
					    CIPHER_SUITE_TKIP)) {
						(bss_desc, CIPHER_SUITE_TKIP)) {
					dev_dbg(adapter->dev,
					dev_dbg(adapter->dev,
						"info: Disable 11n if AES "
						"info: Disable 11n if AES "
						"is not supported by AP\n");
						"is not supported by AP\n");
@@ -418,17 +418,16 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
				}
				}
			}
			}
			return 0;
			return 0;
		} else if (mwifiex_is_network_compatible_for_wpa2(priv,
		} else if (mwifiex_is_bss_wpa2(priv, bss_desc)) {
							bss_desc)) {
			/* WPA2 enabled */
			/* WPA2 enabled */
			if (((priv->adapter->config_bands & BAND_GN
			if (((priv->adapter->config_bands & BAND_GN ||
			      || priv->adapter->config_bands & BAND_AN)
			      priv->adapter->config_bands & BAND_AN) &&
			      && bss_desc->bcn_ht_cap)
			     bss_desc->bcn_ht_cap) &&
			      && !mwifiex_is_rsn_oui_present(bss_desc,
			    !mwifiex_is_rsn_oui_present(bss_desc,
							CIPHER_SUITE_CCMP)) {
							CIPHER_SUITE_CCMP)) {


				if (mwifiex_is_rsn_oui_present(bss_desc,
				if (mwifiex_is_rsn_oui_present
					    CIPHER_SUITE_TKIP)) {
						(bss_desc, CIPHER_SUITE_TKIP)) {
					dev_dbg(adapter->dev,
					dev_dbg(adapter->dev,
						"info: Disable 11n if AES "
						"info: Disable 11n if AES "
						"is not supported by AP\n");
						"is not supported by AP\n");
@@ -438,27 +437,22 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
				}
				}
			}
			}
			return 0;
			return 0;
		} else if (mwifiex_is_network_compatible_for_adhoc_aes(priv,
		} else if (mwifiex_is_bss_adhoc_aes(priv, bss_desc)) {
								bss_desc)) {
			/* Ad-hoc AES enabled */
			/* Ad-hoc AES enabled */
			return 0;
			return 0;
		} else if (mwifiex_is_network_compatible_for_dynamic_wep(priv,
		} else if (mwifiex_is_bss_dynamic_wep(priv, bss_desc)) {
							bss_desc)) {
			/* Dynamic WEP enabled */
			/* Dynamic WEP enabled */
			return 0;
			return 0;
		}
		}


		/* Security doesn't match */
		/* Security doesn't match */
		dev_dbg(adapter->dev, "info: %s: failed: "
		dev_dbg(adapter->dev,
		       "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s EncMode"
			"info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s "
		       "=%#x privacy=%#x\n",
			"WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", __func__,
		       __func__,
			(bss_desc->bcn_wpa_ie) ?
			(bss_desc->bcn_wpa_ie) ?
		       (*(bss_desc->bcn_wpa_ie)).vend_hdr.
			(*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id : 0,
		       element_id : 0,
			(bss_desc->bcn_rsn_ie) ?
			(bss_desc->bcn_rsn_ie) ?
		       (*(bss_desc->bcn_rsn_ie)).ieee_hdr.
			(*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id : 0,
		       element_id : 0,
			(priv->sec_info.wep_enabled) ? "e" : "d",
			(priv->sec_info.wep_enabled) ? "e" : "d",
			(priv->sec_info.wpa_enabled) ? "e" : "d",
			(priv->sec_info.wpa_enabled) ? "e" : "d",
			(priv->sec_info.wpa2_enabled) ? "e" : "d",
			(priv->sec_info.wpa2_enabled) ? "e" : "d",
@@ -594,8 +588,8 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
		 *   - done_early is set (controlling individual scanning of
		 *   - done_early is set (controlling individual scanning of
		 *     1,6,11)
		 *     1,6,11)
		 */
		 */
		while (tlv_idx < max_chan_per_scan
		while (tlv_idx < max_chan_per_scan &&
		       && tmp_chan_list->chan_number && !done_early) {
		       tmp_chan_list->chan_number && !done_early) {


			dev_dbg(priv->adapter->dev,
			dev_dbg(priv->adapter->dev,
				"info: Scan: Chan(%3d), Radio(%d),"
				"info: Scan: Chan(%3d), Radio(%d),"
@@ -648,9 +642,10 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
			/* Stop the loop if the *current* channel is in the
			/* Stop the loop if the *current* channel is in the
			   1,6,11 set and we are not filtering on a BSSID
			   1,6,11 set and we are not filtering on a BSSID
			   or SSID. */
			   or SSID. */
			if (!filtered_scan && (tmp_chan_list->chan_number == 1
			if (!filtered_scan &&
				|| tmp_chan_list->chan_number == 6
			    (tmp_chan_list->chan_number == 1 ||
				|| tmp_chan_list->chan_number == 11))
			     tmp_chan_list->chan_number == 6 ||
			     tmp_chan_list->chan_number == 11))
				done_early = true;
				done_early = true;


			/* Increment the tmp pointer to the next channel to
			/* Increment the tmp pointer to the next channel to
@@ -660,9 +655,10 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
			/* Stop the loop if the *next* channel is in the 1,6,11
			/* Stop the loop if the *next* channel is in the 1,6,11
			   set.  This will cause it to be the only channel
			   set.  This will cause it to be the only channel
			   scanned on the next interation */
			   scanned on the next interation */
			if (!filtered_scan && (tmp_chan_list->chan_number == 1
			if (!filtered_scan &&
				|| tmp_chan_list->chan_number == 6
			    (tmp_chan_list->chan_number == 1 ||
				|| tmp_chan_list->chan_number == 11))
			     tmp_chan_list->chan_number == 6 ||
			     tmp_chan_list->chan_number == 11))
				done_early = true;
				done_early = true;
		}
		}


@@ -714,13 +710,11 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
 * If the number of probes is not set, adapter default setting is used.
 * If the number of probes is not set, adapter default setting is used.
 */
 */
static void
static void
mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
mwifiex_config_scan(struct mwifiex_private *priv,
		    const struct mwifiex_user_scan_cfg *user_scan_in,
		    const struct mwifiex_user_scan_cfg *user_scan_in,
		    struct mwifiex_scan_cmd_config *scan_cfg_out,
		    struct mwifiex_scan_cmd_config *scan_cfg_out,
			       struct mwifiex_ie_types_chan_list_param_set
		    struct mwifiex_ie_types_chan_list_param_set **chan_list_out,
			       **chan_list_out,
		    struct mwifiex_chan_scan_param_set *scan_chan_list,
			       struct mwifiex_chan_scan_param_set
			       *scan_chan_list,
		    u8 *max_chan_per_scan, u8 *filtered_scan,
		    u8 *max_chan_per_scan, u8 *filtered_scan,
		    u8 *scan_current_only)
		    u8 *scan_current_only)
{
{
@@ -840,8 +834,8 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
		 *  truncate scan results.  That is not an issue with an SSID
		 *  truncate scan results.  That is not an issue with an SSID
		 *  or BSSID filter applied to the scan results in the firmware.
		 *  or BSSID filter applied to the scan results in the firmware.
		 */
		 */
		if ((i && ssid_filter)
		if ((i && ssid_filter) ||
		    || memcmp(scan_cfg_out->specific_bssid, &zero_mac,
		    memcmp(scan_cfg_out->specific_bssid, &zero_mac,
			   sizeof(zero_mac)))
			   sizeof(zero_mac)))
			*filtered_scan = true;
			*filtered_scan = true;
	} else {
	} else {
@@ -889,9 +883,9 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,


	dev_dbg(adapter->dev, "info: SCAN_CMD: Rates size = %d\n", rates_size);
	dev_dbg(adapter->dev, "info: SCAN_CMD: Rates size = %d\n", rates_size);


	if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info)
	if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info) &&
	    && (priv->adapter->config_bands & BAND_GN
	    (priv->adapter->config_bands & BAND_GN ||
		|| priv->adapter->config_bands & BAND_AN)) {
	     priv->adapter->config_bands & BAND_AN)) {
		ht_cap = (struct mwifiex_ie_types_htcap *) tlv_pos;
		ht_cap = (struct mwifiex_ie_types_htcap *) tlv_pos;
		memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap));
		memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap));
		ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY);
		ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY);
@@ -920,8 +914,8 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
		dev_dbg(adapter->dev, "info: Scan: Using supplied channel list\n");
		dev_dbg(adapter->dev, "info: Scan: Using supplied channel list\n");


		for (chan_idx = 0;
		for (chan_idx = 0;
		     chan_idx < MWIFIEX_USER_SCAN_CHAN_MAX
		     chan_idx < MWIFIEX_USER_SCAN_CHAN_MAX &&
		     && user_scan_in->chan_list[chan_idx].chan_number;
		     user_scan_in->chan_list[chan_idx].chan_number;
		     chan_idx++) {
		     chan_idx++) {


			channel = user_scan_in->chan_list[chan_idx].chan_number;
			channel = user_scan_in->chan_list[chan_idx].chan_number;
@@ -961,9 +955,9 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
		}
		}


		/* Check if we are only scanning the current channel */
		/* Check if we are only scanning the current channel */
		if ((chan_idx == 1)
		if ((chan_idx == 1) &&
		    && (user_scan_in->chan_list[0].chan_number
		    (user_scan_in->chan_list[0].chan_number ==
			== priv->curr_bss_params.bss_descriptor.channel)) {
		     priv->curr_bss_params.bss_descriptor.channel)) {
			*scan_current_only = true;
			*scan_current_only = true;
			dev_dbg(adapter->dev,
			dev_dbg(adapter->dev,
				"info: Scan: Scanning current channel only\n");
				"info: Scan: Scanning current channel only\n");
@@ -1100,8 +1094,9 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
			bss_entry->ssid.ssid_len = element_len;
			bss_entry->ssid.ssid_len = element_len;
			memcpy(bss_entry->ssid.ssid, (current_ptr + 2),
			memcpy(bss_entry->ssid.ssid, (current_ptr + 2),
			       element_len);
			       element_len);
			dev_dbg(adapter->dev, "info: InterpretIE: ssid: "
			dev_dbg(adapter->dev,
					      "%-32s\n", bss_entry->ssid.ssid);
				"info: InterpretIE: ssid: %-32s\n",
				bss_entry->ssid.ssid);
			break;
			break;


		case WLAN_EID_SUPP_RATES:
		case WLAN_EID_SUPP_RATES:
@@ -1189,13 +1184,13 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
				bss_entry->bcn_wpa_ie =
				bss_entry->bcn_wpa_ie =
					(struct ieee_types_vendor_specific *)
					(struct ieee_types_vendor_specific *)
					current_ptr;
					current_ptr;
				bss_entry->wpa_offset = (u16) (current_ptr -
				bss_entry->wpa_offset = (u16)
							bss_entry->beacon_buf);
					(current_ptr - bss_entry->beacon_buf);
			} else if (!memcmp(vendor_ie->vend_hdr.oui, wmm_oui,
			} else if (!memcmp(vendor_ie->vend_hdr.oui, wmm_oui,
				    sizeof(wmm_oui))) {
				    sizeof(wmm_oui))) {
				if (total_ie_len ==
				if (total_ie_len ==
				    sizeof(struct ieee_types_wmm_parameter)
				    sizeof(struct ieee_types_wmm_parameter) ||
				    || total_ie_len ==
				    total_ie_len ==
				    sizeof(struct ieee_types_wmm_info))
				    sizeof(struct ieee_types_wmm_info))
					/*
					/*
					 * Only accept and copy the WMM IE if
					 * Only accept and copy the WMM IE if
@@ -1331,9 +1326,8 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv,
		return -ENOMEM;
		return -ENOMEM;
	}
	}


	mwifiex_scan_setup_scan_config(priv, user_scan_in,
	mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config,
				       &scan_cfg_out->config, &chan_list_out,
			    &chan_list_out, scan_chan_list, &max_chan_per_scan,
				       scan_chan_list, &max_chan_per_scan,
			    &filtered_scan, &scan_current_chan_only);
			    &filtered_scan, &scan_current_chan_only);


	ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan,
	ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan,
@@ -1663,7 +1657,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
		 *   and capability information
		 *   and capability information
		 */
		 */
		if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) {
		if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) {
			dev_err(adapter->dev, "InterpretIE: not enough bytes left\n");
			dev_err(adapter->dev,
				"InterpretIE: not enough bytes left\n");
			continue;
			continue;
		}
		}
		bcn_param = (struct mwifiex_bcn_param *)current_ptr;
		bcn_param = (struct mwifiex_bcn_param *)current_ptr;
@@ -1673,8 +1668,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
		memcpy(bssid, bcn_param->bssid, ETH_ALEN);
		memcpy(bssid, bcn_param->bssid, ETH_ALEN);


		rssi = (s32) (bcn_param->rssi);
		rssi = (s32) (bcn_param->rssi);
		dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%02X\n",
		dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%02X\n", rssi);
					rssi);


		beacon_period = le16_to_cpu(bcn_param->beacon_period);
		beacon_period = le16_to_cpu(bcn_param->beacon_period);


@@ -1685,8 +1679,9 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
		/* Rest of the current buffer are IE's */
		/* Rest of the current buffer are IE's */
		ie_buf = current_ptr;
		ie_buf = current_ptr;
		ie_len = curr_bcn_bytes;
		ie_len = curr_bcn_bytes;
		dev_dbg(adapter->dev, "info: InterpretIE: IELength for this AP"
		dev_dbg(adapter->dev,
				      " = %d\n", curr_bcn_bytes);
			"info: InterpretIE: IELength for this AP = %d\n",
			curr_bcn_bytes);


		while (curr_bcn_bytes >= sizeof(struct ieee_types_header)) {
		while (curr_bcn_bytes >= sizeof(struct ieee_types_header)) {
			u8 element_id, element_len;
			u8 element_id, element_len;
@@ -1695,8 +1690,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
			element_len = *(current_ptr + 1);
			element_len = *(current_ptr + 1);
			if (curr_bcn_bytes < element_len +
			if (curr_bcn_bytes < element_len +
					sizeof(struct ieee_types_header)) {
					sizeof(struct ieee_types_header)) {
				dev_err(priv->adapter->dev, "%s: in processing"
				dev_err(priv->adapter->dev,
					" IE, bytes left < IE length\n",
					"%s: bytes left < IE length\n",
					__func__);
					__func__);
				goto done;
				goto done;
			}
			}
@@ -1750,12 +1745,14 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
				*(u8 *)bss->priv = band;
				*(u8 *)bss->priv = band;
				cfg80211_put_bss(bss);
				cfg80211_put_bss(bss);


				if (priv->media_connected && !memcmp(bssid,
				if (priv->media_connected &&
				    !memcmp(bssid,
					    priv->curr_bss_params.bss_descriptor
					    priv->curr_bss_params.bss_descriptor
					    .mac_address, ETH_ALEN))
					    .mac_address, ETH_ALEN))
					mwifiex_update_curr_bss_params(priv,
					mwifiex_update_curr_bss_params
							bssid, rssi, ie_buf,
							(priv, bssid, rssi,
							ie_len, beacon_period,
							 ie_buf, ie_len,
							 beacon_period,
							 cap_info_bitmap, band);
							 cap_info_bitmap, band);
			}
			}
		} else {
		} else {
@@ -1783,8 +1780,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
		}
		}


		if (priv->user_scan_cfg) {
		if (priv->user_scan_cfg) {
			dev_dbg(priv->adapter->dev, "info: %s: sending scan "
			dev_dbg(priv->adapter->dev,
							"results\n", __func__);
				"info: %s: sending scan results\n", __func__);
			cfg80211_scan_done(priv->scan_request, 0);
			cfg80211_scan_done(priv->scan_request, 0);
			priv->scan_request = NULL;
			priv->scan_request = NULL;
			kfree(priv->user_scan_cfg);
			kfree(priv->user_scan_cfg);