aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/scan.c
diff options
context:
space:
mode:
authorYogesh Ashok Powar <yogeshp@marvell.com>2012-03-13 22:22:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-03-14 14:39:36 -0400
commitcff23cec822cd6bd0878c2a6afe6140f04c17dcf (patch)
treea25f959de8f4739649f9374c053cab7699a5196c /drivers/net/wireless/mwifiex/scan.c
parentf57c1edc1e0622d2cf883850f37978827bcef573 (diff)
mwifiex: fix checkpatch --strict warnings/errors Part 5
For file scan.c Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/scan.c')
-rw-r--r--drivers/net/wireless/mwifiex/scan.c343
1 files changed, 170 insertions, 173 deletions
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 0a0c2890adfa..aff9cd763f2b 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -125,7 +125,7 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
125 ieee_hdr.element_id == WLAN_EID_RSN))) { 125 ieee_hdr.element_id == WLAN_EID_RSN))) {
126 iebody = (struct ie_body *) 126 iebody = (struct ie_body *)
127 (((u8 *) bss_desc->bcn_rsn_ie->data) + 127 (((u8 *) bss_desc->bcn_rsn_ie->data) +
128 RSN_GTK_OUI_OFFSET); 128 RSN_GTK_OUI_OFFSET);
129 oui = &mwifiex_rsn_oui[cipher][0]; 129 oui = &mwifiex_rsn_oui[cipher][0];
130 ret = mwifiex_search_oui_in_ie(iebody, oui); 130 ret = mwifiex_search_oui_in_ie(iebody, oui);
131 if (ret) 131 if (ret)
@@ -148,8 +148,9 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher)
148 struct ie_body *iebody; 148 struct ie_body *iebody;
149 u8 ret = MWIFIEX_OUI_NOT_PRESENT; 149 u8 ret = MWIFIEX_OUI_NOT_PRESENT;
150 150
151 if (((bss_desc->bcn_wpa_ie) && ((*(bss_desc->bcn_wpa_ie)). 151 if (((bss_desc->bcn_wpa_ie) &&
152 vend_hdr.element_id == WLAN_EID_WPA))) { 152 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id ==
153 WLAN_EID_WPA))) {
153 iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data; 154 iebody = (struct ie_body *) bss_desc->bcn_wpa_ie->data;
154 oui = &mwifiex_wpa_oui[cipher][0]; 155 oui = &mwifiex_wpa_oui[cipher][0];
155 ret = mwifiex_search_oui_in_ie(iebody, oui); 156 ret = mwifiex_search_oui_in_ie(iebody, oui);
@@ -175,8 +176,8 @@ mwifiex_ssid_cmp(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2)
175 * compatible with it. 176 * compatible with it.
176 */ 177 */
177static bool 178static bool
178mwifiex_is_network_compatible_for_wapi(struct mwifiex_private *priv, 179mwifiex_is_bss_wapi(struct mwifiex_private *priv,
179 struct mwifiex_bssdescriptor *bss_desc) 180 struct mwifiex_bssdescriptor *bss_desc)
180{ 181{
181 if (priv->sec_info.wapi_enabled && 182 if (priv->sec_info.wapi_enabled &&
182 (bss_desc->bcn_wapi_ie && 183 (bss_desc->bcn_wapi_ie &&
@@ -192,18 +193,17 @@ mwifiex_is_network_compatible_for_wapi(struct mwifiex_private *priv,
192 * scanned network is compatible with it. 193 * scanned network is compatible with it.
193 */ 194 */
194static bool 195static bool
195mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv, 196mwifiex_is_bss_no_sec(struct mwifiex_private *priv,
196 struct mwifiex_bssdescriptor *bss_desc) 197 struct mwifiex_bssdescriptor *bss_desc)
197{ 198{
198 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && 199 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
199 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) || 200 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) ||
200 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != 201 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id !=
201 WLAN_EID_WPA)) 202 WLAN_EID_WPA)) &&
202 && ((!bss_desc->bcn_rsn_ie) || 203 ((!bss_desc->bcn_rsn_ie) ||
203 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != 204 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id !=
204 WLAN_EID_RSN)) 205 WLAN_EID_RSN)) &&
205 && !priv->sec_info.encryption_mode 206 !priv->sec_info.encryption_mode && !bss_desc->privacy) {
206 && !bss_desc->privacy) {
207 return true; 207 return true;
208 } 208 }
209 return false; 209 return false;
@@ -214,8 +214,8 @@ mwifiex_is_network_compatible_for_no_sec(struct mwifiex_private *priv,
214 * is compatible with it. 214 * is compatible with it.
215 */ 215 */
216static bool 216static bool
217mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv, 217mwifiex_is_bss_static_wep(struct mwifiex_private *priv,
218 struct mwifiex_bssdescriptor *bss_desc) 218 struct mwifiex_bssdescriptor *bss_desc)
219{ 219{
220 if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && 220 if (priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
221 !priv->sec_info.wpa2_enabled && bss_desc->privacy) { 221 !priv->sec_info.wpa2_enabled && bss_desc->privacy) {
@@ -229,8 +229,8 @@ mwifiex_is_network_compatible_for_static_wep(struct mwifiex_private *priv,
229 * compatible with it. 229 * compatible with it.
230 */ 230 */
231static bool 231static bool
232mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv, 232mwifiex_is_bss_wpa(struct mwifiex_private *priv,
233 struct mwifiex_bssdescriptor *bss_desc) 233 struct mwifiex_bssdescriptor *bss_desc)
234{ 234{
235 if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled && 235 if (!priv->sec_info.wep_enabled && priv->sec_info.wpa_enabled &&
236 !priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) && 236 !priv->sec_info.wpa2_enabled && ((bss_desc->bcn_wpa_ie) &&
@@ -264,17 +264,18 @@ mwifiex_is_network_compatible_for_wpa(struct mwifiex_private *priv,
264 * compatible with it. 264 * compatible with it.
265 */ 265 */
266static bool 266static bool
267mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv, 267mwifiex_is_bss_wpa2(struct mwifiex_private *priv,
268 struct mwifiex_bssdescriptor *bss_desc) 268 struct mwifiex_bssdescriptor *bss_desc)
269{ 269{
270 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && 270 if (!priv->sec_info.wep_enabled &&
271 priv->sec_info.wpa2_enabled && ((bss_desc->bcn_rsn_ie) && 271 !priv->sec_info.wpa_enabled &&
272 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN)) 272 priv->sec_info.wpa2_enabled &&
273 /* 273 ((bss_desc->bcn_rsn_ie) &&
274 * Privacy bit may NOT be set in some APs like 274 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id == WLAN_EID_RSN))) {
275 * LinkSys WRT54G && bss_desc->privacy 275 /*
276 */ 276 * Privacy bit may NOT be set in some APs like
277 ) { 277 * LinkSys WRT54G && bss_desc->privacy
278 */
278 dev_dbg(priv->adapter->dev, "info: %s: WPA2: " 279 dev_dbg(priv->adapter->dev, "info: %s: WPA2: "
279 " wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 280 " wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
280 "EncMode=%#x privacy=%#x\n", __func__, 281 "EncMode=%#x privacy=%#x\n", __func__,
@@ -299,16 +300,16 @@ mwifiex_is_network_compatible_for_wpa2(struct mwifiex_private *priv,
299 * compatible with it. 300 * compatible with it.
300 */ 301 */
301static bool 302static bool
302mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv, 303mwifiex_is_bss_adhoc_aes(struct mwifiex_private *priv,
303 struct mwifiex_bssdescriptor *bss_desc) 304 struct mwifiex_bssdescriptor *bss_desc)
304{ 305{
305 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && 306 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
306 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) || 307 !priv->sec_info.wpa2_enabled &&
307 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) 308 ((!bss_desc->bcn_wpa_ie) ||
308 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. 309 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) &&
309 element_id != WLAN_EID_RSN)) 310 ((!bss_desc->bcn_rsn_ie) ||
310 && !priv->sec_info.encryption_mode 311 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
311 && bss_desc->privacy) { 312 !priv->sec_info.encryption_mode && bss_desc->privacy) {
312 return true; 313 return true;
313 } 314 }
314 return false; 315 return false;
@@ -319,16 +320,16 @@ mwifiex_is_network_compatible_for_adhoc_aes(struct mwifiex_private *priv,
319 * is compatible with it. 320 * is compatible with it.
320 */ 321 */
321static bool 322static bool
322mwifiex_is_network_compatible_for_dynamic_wep(struct mwifiex_private *priv, 323mwifiex_is_bss_dynamic_wep(struct mwifiex_private *priv,
323 struct mwifiex_bssdescriptor *bss_desc) 324 struct mwifiex_bssdescriptor *bss_desc)
324{ 325{
325 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled && 326 if (!priv->sec_info.wep_enabled && !priv->sec_info.wpa_enabled &&
326 !priv->sec_info.wpa2_enabled && ((!bss_desc->bcn_wpa_ie) || 327 !priv->sec_info.wpa2_enabled &&
327 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) 328 ((!bss_desc->bcn_wpa_ie) ||
328 && ((!bss_desc->bcn_rsn_ie) || ((*(bss_desc->bcn_rsn_ie)).ieee_hdr. 329 ((*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id != WLAN_EID_WPA)) &&
329 element_id != WLAN_EID_RSN)) 330 ((!bss_desc->bcn_rsn_ie) ||
330 && priv->sec_info.encryption_mode 331 ((*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id != WLAN_EID_RSN)) &&
331 && bss_desc->privacy) { 332 priv->sec_info.encryption_mode && bss_desc->privacy) {
332 dev_dbg(priv->adapter->dev, "info: %s: dynamic " 333 dev_dbg(priv->adapter->dev, "info: %s: dynamic "
333 "WEP: wpa_ie=%#x wpa2_ie=%#x " 334 "WEP: wpa_ie=%#x wpa2_ie=%#x "
334 "EncMode=%#x privacy=%#x\n", 335 "EncMode=%#x privacy=%#x\n",
@@ -373,8 +374,9 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
373 bss_desc->disable_11n = false; 374 bss_desc->disable_11n = false;
374 375
375 /* Don't check for compatibility if roaming */ 376 /* Don't check for compatibility if roaming */
376 if (priv->media_connected && (priv->bss_mode == NL80211_IFTYPE_STATION) 377 if (priv->media_connected &&
377 && (bss_desc->bss_mode == NL80211_IFTYPE_STATION)) 378 (priv->bss_mode == NL80211_IFTYPE_STATION) &&
379 (bss_desc->bss_mode == NL80211_IFTYPE_STATION))
378 return 0; 380 return 0;
379 381
380 if (priv->wps.session_enable) { 382 if (priv->wps.session_enable) {
@@ -383,32 +385,30 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
383 return 0; 385 return 0;
384 } 386 }
385 387
386 if (mwifiex_is_network_compatible_for_wapi(priv, bss_desc)) { 388 if (mwifiex_is_bss_wapi(priv, bss_desc)) {
387 dev_dbg(adapter->dev, "info: return success for WAPI AP\n"); 389 dev_dbg(adapter->dev, "info: return success for WAPI AP\n");
388 return 0; 390 return 0;
389 } 391 }
390 392
391 if (bss_desc->bss_mode == mode) { 393 if (bss_desc->bss_mode == mode) {
392 if (mwifiex_is_network_compatible_for_no_sec(priv, bss_desc)) { 394 if (mwifiex_is_bss_no_sec(priv, bss_desc)) {
393 /* No security */ 395 /* No security */
394 return 0; 396 return 0;
395 } else if (mwifiex_is_network_compatible_for_static_wep(priv, 397 } else if (mwifiex_is_bss_static_wep(priv, bss_desc)) {
396 bss_desc)) {
397 /* Static WEP enabled */ 398 /* Static WEP enabled */
398 dev_dbg(adapter->dev, "info: Disable 11n in WEP mode.\n"); 399 dev_dbg(adapter->dev, "info: Disable 11n in WEP mode.\n");
399 bss_desc->disable_11n = true; 400 bss_desc->disable_11n = true;
400 return 0; 401 return 0;
401 } else if (mwifiex_is_network_compatible_for_wpa(priv, 402 } else if (mwifiex_is_bss_wpa(priv, bss_desc)) {
402 bss_desc)) {
403 /* WPA enabled */ 403 /* WPA enabled */
404 if (((priv->adapter->config_bands & BAND_GN 404 if (((priv->adapter->config_bands & BAND_GN ||
405 || priv->adapter->config_bands & BAND_AN) 405 priv->adapter->config_bands & BAND_AN) &&
406 && bss_desc->bcn_ht_cap) 406 bss_desc->bcn_ht_cap) &&
407 && !mwifiex_is_wpa_oui_present(bss_desc, 407 !mwifiex_is_wpa_oui_present(bss_desc,
408 CIPHER_SUITE_CCMP)) { 408 CIPHER_SUITE_CCMP)) {
409 409
410 if (mwifiex_is_wpa_oui_present(bss_desc, 410 if (mwifiex_is_wpa_oui_present
411 CIPHER_SUITE_TKIP)) { 411 (bss_desc, CIPHER_SUITE_TKIP)) {
412 dev_dbg(adapter->dev, 412 dev_dbg(adapter->dev,
413 "info: Disable 11n if AES " 413 "info: Disable 11n if AES "
414 "is not supported by AP\n"); 414 "is not supported by AP\n");
@@ -418,17 +418,16 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
418 } 418 }
419 } 419 }
420 return 0; 420 return 0;
421 } else if (mwifiex_is_network_compatible_for_wpa2(priv, 421 } else if (mwifiex_is_bss_wpa2(priv, bss_desc)) {
422 bss_desc)) {
423 /* WPA2 enabled */ 422 /* WPA2 enabled */
424 if (((priv->adapter->config_bands & BAND_GN 423 if (((priv->adapter->config_bands & BAND_GN ||
425 || priv->adapter->config_bands & BAND_AN) 424 priv->adapter->config_bands & BAND_AN) &&
426 && bss_desc->bcn_ht_cap) 425 bss_desc->bcn_ht_cap) &&
427 && !mwifiex_is_rsn_oui_present(bss_desc, 426 !mwifiex_is_rsn_oui_present(bss_desc,
428 CIPHER_SUITE_CCMP)) { 427 CIPHER_SUITE_CCMP)) {
429 428
430 if (mwifiex_is_rsn_oui_present(bss_desc, 429 if (mwifiex_is_rsn_oui_present
431 CIPHER_SUITE_TKIP)) { 430 (bss_desc, CIPHER_SUITE_TKIP)) {
432 dev_dbg(adapter->dev, 431 dev_dbg(adapter->dev,
433 "info: Disable 11n if AES " 432 "info: Disable 11n if AES "
434 "is not supported by AP\n"); 433 "is not supported by AP\n");
@@ -438,31 +437,26 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
438 } 437 }
439 } 438 }
440 return 0; 439 return 0;
441 } else if (mwifiex_is_network_compatible_for_adhoc_aes(priv, 440 } else if (mwifiex_is_bss_adhoc_aes(priv, bss_desc)) {
442 bss_desc)) {
443 /* Ad-hoc AES enabled */ 441 /* Ad-hoc AES enabled */
444 return 0; 442 return 0;
445 } else if (mwifiex_is_network_compatible_for_dynamic_wep(priv, 443 } else if (mwifiex_is_bss_dynamic_wep(priv, bss_desc)) {
446 bss_desc)) {
447 /* Dynamic WEP enabled */ 444 /* Dynamic WEP enabled */
448 return 0; 445 return 0;
449 } 446 }
450 447
451 /* Security doesn't match */ 448 /* Security doesn't match */
452 dev_dbg(adapter->dev, "info: %s: failed: " 449 dev_dbg(adapter->dev,
453 "wpa_ie=%#x wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s EncMode" 450 "info: %s: failed: wpa_ie=%#x wpa2_ie=%#x WEP=%s "
454 "=%#x privacy=%#x\n", 451 "WPA=%s WPA2=%s EncMode=%#x privacy=%#x\n", __func__,
455 __func__, 452 (bss_desc->bcn_wpa_ie) ?
456 (bss_desc->bcn_wpa_ie) ? 453 (*(bss_desc->bcn_wpa_ie)).vend_hdr.element_id : 0,
457 (*(bss_desc->bcn_wpa_ie)).vend_hdr. 454 (bss_desc->bcn_rsn_ie) ?
458 element_id : 0, 455 (*(bss_desc->bcn_rsn_ie)).ieee_hdr.element_id : 0,
459 (bss_desc->bcn_rsn_ie) ? 456 (priv->sec_info.wep_enabled) ? "e" : "d",
460 (*(bss_desc->bcn_rsn_ie)).ieee_hdr. 457 (priv->sec_info.wpa_enabled) ? "e" : "d",
461 element_id : 0, 458 (priv->sec_info.wpa2_enabled) ? "e" : "d",
462 (priv->sec_info.wep_enabled) ? "e" : "d", 459 priv->sec_info.encryption_mode, bss_desc->privacy);
463 (priv->sec_info.wpa_enabled) ? "e" : "d",
464 (priv->sec_info.wpa2_enabled) ? "e" : "d",
465 priv->sec_info.encryption_mode, bss_desc->privacy);
466 return -1; 460 return -1;
467 } 461 }
468 462
@@ -479,11 +473,11 @@ mwifiex_is_network_compatible(struct mwifiex_private *priv,
479 */ 473 */
480static void 474static void
481mwifiex_scan_create_channel_list(struct mwifiex_private *priv, 475mwifiex_scan_create_channel_list(struct mwifiex_private *priv,
482 const struct mwifiex_user_scan_cfg 476 const struct mwifiex_user_scan_cfg
483 *user_scan_in, 477 *user_scan_in,
484 struct mwifiex_chan_scan_param_set 478 struct mwifiex_chan_scan_param_set
485 *scan_chan_list, 479 *scan_chan_list,
486 u8 filtered_scan) 480 u8 filtered_scan)
487{ 481{
488 enum ieee80211_band band; 482 enum ieee80211_band band;
489 struct ieee80211_supported_band *sband; 483 struct ieee80211_supported_band *sband;
@@ -505,7 +499,7 @@ mwifiex_scan_create_channel_list(struct mwifiex_private *priv,
505 scan_chan_list[chan_idx].radio_type = band; 499 scan_chan_list[chan_idx].radio_type = band;
506 500
507 if (user_scan_in && 501 if (user_scan_in &&
508 user_scan_in->chan_list[0].scan_time) 502 user_scan_in->chan_list[0].scan_time)
509 scan_chan_list[chan_idx].max_scan_time = 503 scan_chan_list[chan_idx].max_scan_time =
510 cpu_to_le16((u16) user_scan_in-> 504 cpu_to_le16((u16) user_scan_in->
511 chan_list[0].scan_time); 505 chan_list[0].scan_time);
@@ -594,19 +588,19 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
594 * - done_early is set (controlling individual scanning of 588 * - done_early is set (controlling individual scanning of
595 * 1,6,11) 589 * 1,6,11)
596 */ 590 */
597 while (tlv_idx < max_chan_per_scan 591 while (tlv_idx < max_chan_per_scan &&
598 && tmp_chan_list->chan_number && !done_early) { 592 tmp_chan_list->chan_number && !done_early) {
599 593
600 dev_dbg(priv->adapter->dev, 594 dev_dbg(priv->adapter->dev,
601 "info: Scan: Chan(%3d), Radio(%d)," 595 "info: Scan: Chan(%3d), Radio(%d),"
602 " Mode(%d, %d), Dur(%d)\n", 596 " Mode(%d, %d), Dur(%d)\n",
603 tmp_chan_list->chan_number, 597 tmp_chan_list->chan_number,
604 tmp_chan_list->radio_type, 598 tmp_chan_list->radio_type,
605 tmp_chan_list->chan_scan_mode_bitmap 599 tmp_chan_list->chan_scan_mode_bitmap
606 & MWIFIEX_PASSIVE_SCAN, 600 & MWIFIEX_PASSIVE_SCAN,
607 (tmp_chan_list->chan_scan_mode_bitmap 601 (tmp_chan_list->chan_scan_mode_bitmap
608 & MWIFIEX_DISABLE_CHAN_FILT) >> 1, 602 & MWIFIEX_DISABLE_CHAN_FILT) >> 1,
609 le16_to_cpu(tmp_chan_list->max_scan_time)); 603 le16_to_cpu(tmp_chan_list->max_scan_time));
610 604
611 /* Copy the current channel TLV to the command being 605 /* Copy the current channel TLV to the command being
612 prepared */ 606 prepared */
@@ -648,9 +642,10 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
648 /* Stop the loop if the *current* channel is in the 642 /* Stop the loop if the *current* channel is in the
649 1,6,11 set and we are not filtering on a BSSID 643 1,6,11 set and we are not filtering on a BSSID
650 or SSID. */ 644 or SSID. */
651 if (!filtered_scan && (tmp_chan_list->chan_number == 1 645 if (!filtered_scan &&
652 || tmp_chan_list->chan_number == 6 646 (tmp_chan_list->chan_number == 1 ||
653 || tmp_chan_list->chan_number == 11)) 647 tmp_chan_list->chan_number == 6 ||
648 tmp_chan_list->chan_number == 11))
654 done_early = true; 649 done_early = true;
655 650
656 /* Increment the tmp pointer to the next channel to 651 /* Increment the tmp pointer to the next channel to
@@ -660,9 +655,10 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
660 /* Stop the loop if the *next* channel is in the 1,6,11 655 /* Stop the loop if the *next* channel is in the 1,6,11
661 set. This will cause it to be the only channel 656 set. This will cause it to be the only channel
662 scanned on the next interation */ 657 scanned on the next interation */
663 if (!filtered_scan && (tmp_chan_list->chan_number == 1 658 if (!filtered_scan &&
664 || tmp_chan_list->chan_number == 6 659 (tmp_chan_list->chan_number == 1 ||
665 || tmp_chan_list->chan_number == 11)) 660 tmp_chan_list->chan_number == 6 ||
661 tmp_chan_list->chan_number == 11))
666 done_early = true; 662 done_early = true;
667 } 663 }
668 664
@@ -714,15 +710,13 @@ mwifiex_scan_channel_list(struct mwifiex_private *priv,
714 * If the number of probes is not set, adapter default setting is used. 710 * If the number of probes is not set, adapter default setting is used.
715 */ 711 */
716static void 712static void
717mwifiex_scan_setup_scan_config(struct mwifiex_private *priv, 713mwifiex_config_scan(struct mwifiex_private *priv,
718 const struct mwifiex_user_scan_cfg *user_scan_in, 714 const struct mwifiex_user_scan_cfg *user_scan_in,
719 struct mwifiex_scan_cmd_config *scan_cfg_out, 715 struct mwifiex_scan_cmd_config *scan_cfg_out,
720 struct mwifiex_ie_types_chan_list_param_set 716 struct mwifiex_ie_types_chan_list_param_set **chan_list_out,
721 **chan_list_out, 717 struct mwifiex_chan_scan_param_set *scan_chan_list,
722 struct mwifiex_chan_scan_param_set 718 u8 *max_chan_per_scan, u8 *filtered_scan,
723 *scan_chan_list, 719 u8 *scan_current_only)
724 u8 *max_chan_per_scan, u8 *filtered_scan,
725 u8 *scan_current_only)
726{ 720{
727 struct mwifiex_adapter *adapter = priv->adapter; 721 struct mwifiex_adapter *adapter = priv->adapter;
728 struct mwifiex_ie_types_num_probes *num_probes_tlv; 722 struct mwifiex_ie_types_num_probes *num_probes_tlv;
@@ -840,9 +834,9 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
840 * truncate scan results. That is not an issue with an SSID 834 * truncate scan results. That is not an issue with an SSID
841 * or BSSID filter applied to the scan results in the firmware. 835 * or BSSID filter applied to the scan results in the firmware.
842 */ 836 */
843 if ((i && ssid_filter) 837 if ((i && ssid_filter) ||
844 || memcmp(scan_cfg_out->specific_bssid, &zero_mac, 838 memcmp(scan_cfg_out->specific_bssid, &zero_mac,
845 sizeof(zero_mac))) 839 sizeof(zero_mac)))
846 *filtered_scan = true; 840 *filtered_scan = true;
847 } else { 841 } else {
848 scan_cfg_out->bss_mode = (u8) adapter->scan_mode; 842 scan_cfg_out->bss_mode = (u8) adapter->scan_mode;
@@ -863,7 +857,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
863 if (num_probes) { 857 if (num_probes) {
864 858
865 dev_dbg(adapter->dev, "info: scan: num_probes = %d\n", 859 dev_dbg(adapter->dev, "info: scan: num_probes = %d\n",
866 num_probes); 860 num_probes);
867 861
868 num_probes_tlv = (struct mwifiex_ie_types_num_probes *) tlv_pos; 862 num_probes_tlv = (struct mwifiex_ie_types_num_probes *) tlv_pos;
869 num_probes_tlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES); 863 num_probes_tlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES);
@@ -889,9 +883,9 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
889 883
890 dev_dbg(adapter->dev, "info: SCAN_CMD: Rates size = %d\n", rates_size); 884 dev_dbg(adapter->dev, "info: SCAN_CMD: Rates size = %d\n", rates_size);
891 885
892 if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info) 886 if (ISSUPP_11NENABLED(priv->adapter->fw_cap_info) &&
893 && (priv->adapter->config_bands & BAND_GN 887 (priv->adapter->config_bands & BAND_GN ||
894 || priv->adapter->config_bands & BAND_AN)) { 888 priv->adapter->config_bands & BAND_AN)) {
895 ht_cap = (struct mwifiex_ie_types_htcap *) tlv_pos; 889 ht_cap = (struct mwifiex_ie_types_htcap *) tlv_pos;
896 memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap)); 890 memset(ht_cap, 0, sizeof(struct mwifiex_ie_types_htcap));
897 ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); 891 ht_cap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY);
@@ -920,8 +914,8 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
920 dev_dbg(adapter->dev, "info: Scan: Using supplied channel list\n"); 914 dev_dbg(adapter->dev, "info: Scan: Using supplied channel list\n");
921 915
922 for (chan_idx = 0; 916 for (chan_idx = 0;
923 chan_idx < MWIFIEX_USER_SCAN_CHAN_MAX 917 chan_idx < MWIFIEX_USER_SCAN_CHAN_MAX &&
924 && user_scan_in->chan_list[chan_idx].chan_number; 918 user_scan_in->chan_list[chan_idx].chan_number;
925 chan_idx++) { 919 chan_idx++) {
926 920
927 channel = user_scan_in->chan_list[chan_idx].chan_number; 921 channel = user_scan_in->chan_list[chan_idx].chan_number;
@@ -961,9 +955,9 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
961 } 955 }
962 956
963 /* Check if we are only scanning the current channel */ 957 /* Check if we are only scanning the current channel */
964 if ((chan_idx == 1) 958 if ((chan_idx == 1) &&
965 && (user_scan_in->chan_list[0].chan_number 959 (user_scan_in->chan_list[0].chan_number ==
966 == priv->curr_bss_params.bss_descriptor.channel)) { 960 priv->curr_bss_params.bss_descriptor.channel)) {
967 *scan_current_only = true; 961 *scan_current_only = true;
968 dev_dbg(adapter->dev, 962 dev_dbg(adapter->dev,
969 "info: Scan: Scanning current channel only\n"); 963 "info: Scan: Scanning current channel only\n");
@@ -971,7 +965,7 @@ mwifiex_scan_setup_scan_config(struct mwifiex_private *priv,
971 965
972 } else { 966 } else {
973 dev_dbg(adapter->dev, 967 dev_dbg(adapter->dev,
974 "info: Scan: Creating full region channel list\n"); 968 "info: Scan: Creating full region channel list\n");
975 mwifiex_scan_create_channel_list(priv, user_scan_in, 969 mwifiex_scan_create_channel_list(priv, user_scan_in,
976 scan_chan_list, 970 scan_chan_list,
977 *filtered_scan); 971 *filtered_scan);
@@ -1003,7 +997,7 @@ mwifiex_ret_802_11_scan_get_tlv_ptrs(struct mwifiex_adapter *adapter,
1003 *tlv_data = NULL; 997 *tlv_data = NULL;
1004 998
1005 dev_dbg(adapter->dev, "info: SCAN_RESP: tlv_buf_size = %d\n", 999 dev_dbg(adapter->dev, "info: SCAN_RESP: tlv_buf_size = %d\n",
1006 tlv_buf_size); 1000 tlv_buf_size);
1007 1001
1008 while (tlv_buf_left >= sizeof(struct mwifiex_ie_types_header)) { 1002 while (tlv_buf_left >= sizeof(struct mwifiex_ie_types_header)) {
1009 1003
@@ -1100,8 +1094,9 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1100 bss_entry->ssid.ssid_len = element_len; 1094 bss_entry->ssid.ssid_len = element_len;
1101 memcpy(bss_entry->ssid.ssid, (current_ptr + 2), 1095 memcpy(bss_entry->ssid.ssid, (current_ptr + 2),
1102 element_len); 1096 element_len);
1103 dev_dbg(adapter->dev, "info: InterpretIE: ssid: " 1097 dev_dbg(adapter->dev,
1104 "%-32s\n", bss_entry->ssid.ssid); 1098 "info: InterpretIE: ssid: %-32s\n",
1099 bss_entry->ssid.ssid);
1105 break; 1100 break;
1106 1101
1107 case WLAN_EID_SUPP_RATES: 1102 case WLAN_EID_SUPP_RATES:
@@ -1189,13 +1184,13 @@ mwifiex_update_bss_desc_with_ie(struct mwifiex_adapter *adapter,
1189 bss_entry->bcn_wpa_ie = 1184 bss_entry->bcn_wpa_ie =
1190 (struct ieee_types_vendor_specific *) 1185 (struct ieee_types_vendor_specific *)
1191 current_ptr; 1186 current_ptr;
1192 bss_entry->wpa_offset = (u16) (current_ptr - 1187 bss_entry->wpa_offset = (u16)
1193 bss_entry->beacon_buf); 1188 (current_ptr - bss_entry->beacon_buf);
1194 } else if (!memcmp(vendor_ie->vend_hdr.oui, wmm_oui, 1189 } else if (!memcmp(vendor_ie->vend_hdr.oui, wmm_oui,
1195 sizeof(wmm_oui))) { 1190 sizeof(wmm_oui))) {
1196 if (total_ie_len == 1191 if (total_ie_len ==
1197 sizeof(struct ieee_types_wmm_parameter) 1192 sizeof(struct ieee_types_wmm_parameter) ||
1198 || total_ie_len == 1193 total_ie_len ==
1199 sizeof(struct ieee_types_wmm_info)) 1194 sizeof(struct ieee_types_wmm_info))
1200 /* 1195 /*
1201 * Only accept and copy the WMM IE if 1196 * Only accept and copy the WMM IE if
@@ -1316,14 +1311,14 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv,
1316 } 1311 }
1317 1312
1318 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), 1313 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
1319 GFP_KERNEL); 1314 GFP_KERNEL);
1320 if (!scan_cfg_out) { 1315 if (!scan_cfg_out) {
1321 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); 1316 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
1322 return -ENOMEM; 1317 return -ENOMEM;
1323 } 1318 }
1324 1319
1325 buf_size = sizeof(struct mwifiex_chan_scan_param_set) * 1320 buf_size = sizeof(struct mwifiex_chan_scan_param_set) *
1326 MWIFIEX_USER_SCAN_CHAN_MAX; 1321 MWIFIEX_USER_SCAN_CHAN_MAX;
1327 scan_chan_list = kzalloc(buf_size, GFP_KERNEL); 1322 scan_chan_list = kzalloc(buf_size, GFP_KERNEL);
1328 if (!scan_chan_list) { 1323 if (!scan_chan_list) {
1329 dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); 1324 dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
@@ -1331,10 +1326,9 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv,
1331 return -ENOMEM; 1326 return -ENOMEM;
1332 } 1327 }
1333 1328
1334 mwifiex_scan_setup_scan_config(priv, user_scan_in, 1329 mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config,
1335 &scan_cfg_out->config, &chan_list_out, 1330 &chan_list_out, scan_chan_list, &max_chan_per_scan,
1336 scan_chan_list, &max_chan_per_scan, 1331 &filtered_scan, &scan_current_chan_only);
1337 &filtered_scan, &scan_current_chan_only);
1338 1332
1339 ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan, 1333 ret = mwifiex_scan_channel_list(priv, max_chan_per_scan, filtered_scan,
1340 &scan_cfg_out->config, chan_list_out, 1334 &scan_cfg_out->config, chan_list_out,
@@ -1345,10 +1339,10 @@ static int mwifiex_scan_networks(struct mwifiex_private *priv,
1345 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags); 1339 spin_lock_irqsave(&adapter->scan_pending_q_lock, flags);
1346 if (!list_empty(&adapter->scan_pending_q)) { 1340 if (!list_empty(&adapter->scan_pending_q)) {
1347 cmd_node = list_first_entry(&adapter->scan_pending_q, 1341 cmd_node = list_first_entry(&adapter->scan_pending_q,
1348 struct cmd_ctrl_node, list); 1342 struct cmd_ctrl_node, list);
1349 list_del(&cmd_node->list); 1343 list_del(&cmd_node->list);
1350 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 1344 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1351 flags); 1345 flags);
1352 adapter->cmd_queued = cmd_node; 1346 adapter->cmd_queued = cmd_node;
1353 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node, 1347 mwifiex_insert_cmd_to_pending_q(adapter, cmd_node,
1354 true); 1348 true);
@@ -1514,7 +1508,7 @@ mwifiex_update_curr_bss_params(struct mwifiex_private *priv, u8 *bssid,
1514 1508
1515 /* Make a copy of current BSSID descriptor */ 1509 /* Make a copy of current BSSID descriptor */
1516 memcpy(&priv->curr_bss_params.bss_descriptor, bss_desc, 1510 memcpy(&priv->curr_bss_params.bss_descriptor, bss_desc,
1517 sizeof(priv->curr_bss_params.bss_descriptor)); 1511 sizeof(priv->curr_bss_params.bss_descriptor));
1518 mwifiex_save_curr_bcn(priv); 1512 mwifiex_save_curr_bcn(priv);
1519 spin_unlock_irqrestore(&priv->curr_bcn_buf_lock, flags); 1513 spin_unlock_irqrestore(&priv->curr_bcn_buf_lock, flags);
1520 1514
@@ -1565,7 +1559,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1565 struct cfg80211_bss *bss; 1559 struct cfg80211_bss *bss;
1566 1560
1567 is_bgscan_resp = (le16_to_cpu(resp->command) 1561 is_bgscan_resp = (le16_to_cpu(resp->command)
1568 == HostCmd_CMD_802_11_BG_SCAN_QUERY); 1562 == HostCmd_CMD_802_11_BG_SCAN_QUERY);
1569 if (is_bgscan_resp) 1563 if (is_bgscan_resp)
1570 scan_rsp = &resp->params.bg_scan_query_resp.scan_resp; 1564 scan_rsp = &resp->params.bg_scan_query_resp.scan_resp;
1571 else 1565 else
@@ -1574,20 +1568,20 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1574 1568
1575 if (scan_rsp->number_of_sets > MWIFIEX_MAX_AP) { 1569 if (scan_rsp->number_of_sets > MWIFIEX_MAX_AP) {
1576 dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n", 1570 dev_err(adapter->dev, "SCAN_RESP: too many AP returned (%d)\n",
1577 scan_rsp->number_of_sets); 1571 scan_rsp->number_of_sets);
1578 ret = -1; 1572 ret = -1;
1579 goto done; 1573 goto done;
1580 } 1574 }
1581 1575
1582 bytes_left = le16_to_cpu(scan_rsp->bss_descript_size); 1576 bytes_left = le16_to_cpu(scan_rsp->bss_descript_size);
1583 dev_dbg(adapter->dev, "info: SCAN_RESP: bss_descript_size %d\n", 1577 dev_dbg(adapter->dev, "info: SCAN_RESP: bss_descript_size %d\n",
1584 bytes_left); 1578 bytes_left);
1585 1579
1586 scan_resp_size = le16_to_cpu(resp->size); 1580 scan_resp_size = le16_to_cpu(resp->size);
1587 1581
1588 dev_dbg(adapter->dev, 1582 dev_dbg(adapter->dev,
1589 "info: SCAN_RESP: returned %d APs before parsing\n", 1583 "info: SCAN_RESP: returned %d APs before parsing\n",
1590 scan_rsp->number_of_sets); 1584 scan_rsp->number_of_sets);
1591 1585
1592 bss_info = scan_rsp->bss_desc_and_tlv_buffer; 1586 bss_info = scan_rsp->bss_desc_and_tlv_buffer;
1593 1587
@@ -1663,7 +1657,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1663 * and capability information 1657 * and capability information
1664 */ 1658 */
1665 if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) { 1659 if (curr_bcn_bytes < sizeof(struct mwifiex_bcn_param)) {
1666 dev_err(adapter->dev, "InterpretIE: not enough bytes left\n"); 1660 dev_err(adapter->dev,
1661 "InterpretIE: not enough bytes left\n");
1667 continue; 1662 continue;
1668 } 1663 }
1669 bcn_param = (struct mwifiex_bcn_param *)current_ptr; 1664 bcn_param = (struct mwifiex_bcn_param *)current_ptr;
@@ -1673,20 +1668,20 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1673 memcpy(bssid, bcn_param->bssid, ETH_ALEN); 1668 memcpy(bssid, bcn_param->bssid, ETH_ALEN);
1674 1669
1675 rssi = (s32) (bcn_param->rssi); 1670 rssi = (s32) (bcn_param->rssi);
1676 dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%02X\n", 1671 dev_dbg(adapter->dev, "info: InterpretIE: RSSI=%02X\n", rssi);
1677 rssi);
1678 1672
1679 beacon_period = le16_to_cpu(bcn_param->beacon_period); 1673 beacon_period = le16_to_cpu(bcn_param->beacon_period);
1680 1674
1681 cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap); 1675 cap_info_bitmap = le16_to_cpu(bcn_param->cap_info_bitmap);
1682 dev_dbg(adapter->dev, "info: InterpretIE: capabilities=0x%X\n", 1676 dev_dbg(adapter->dev, "info: InterpretIE: capabilities=0x%X\n",
1683 cap_info_bitmap); 1677 cap_info_bitmap);
1684 1678
1685 /* Rest of the current buffer are IE's */ 1679 /* Rest of the current buffer are IE's */
1686 ie_buf = current_ptr; 1680 ie_buf = current_ptr;
1687 ie_len = curr_bcn_bytes; 1681 ie_len = curr_bcn_bytes;
1688 dev_dbg(adapter->dev, "info: InterpretIE: IELength for this AP" 1682 dev_dbg(adapter->dev,
1689 " = %d\n", curr_bcn_bytes); 1683 "info: InterpretIE: IELength for this AP = %d\n",
1684 curr_bcn_bytes);
1690 1685
1691 while (curr_bcn_bytes >= sizeof(struct ieee_types_header)) { 1686 while (curr_bcn_bytes >= sizeof(struct ieee_types_header)) {
1692 u8 element_id, element_len; 1687 u8 element_id, element_len;
@@ -1695,8 +1690,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1695 element_len = *(current_ptr + 1); 1690 element_len = *(current_ptr + 1);
1696 if (curr_bcn_bytes < element_len + 1691 if (curr_bcn_bytes < element_len +
1697 sizeof(struct ieee_types_header)) { 1692 sizeof(struct ieee_types_header)) {
1698 dev_err(priv->adapter->dev, "%s: in processing" 1693 dev_err(priv->adapter->dev,
1699 " IE, bytes left < IE length\n", 1694 "%s: bytes left < IE length\n",
1700 __func__); 1695 __func__);
1701 goto done; 1696 goto done;
1702 } 1697 }
@@ -1720,8 +1715,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1720 */ 1715 */
1721 if (tsf_tlv) 1716 if (tsf_tlv)
1722 memcpy(&network_tsf, 1717 memcpy(&network_tsf,
1723 &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE], 1718 &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE],
1724 sizeof(network_tsf)); 1719 sizeof(network_tsf));
1725 1720
1726 if (channel) { 1721 if (channel) {
1727 struct ieee80211_channel *chan; 1722 struct ieee80211_channel *chan;
@@ -1750,13 +1745,15 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1750 *(u8 *)bss->priv = band; 1745 *(u8 *)bss->priv = band;
1751 cfg80211_put_bss(bss); 1746 cfg80211_put_bss(bss);
1752 1747
1753 if (priv->media_connected && !memcmp(bssid, 1748 if (priv->media_connected &&
1754 priv->curr_bss_params.bss_descriptor 1749 !memcmp(bssid,
1755 .mac_address, ETH_ALEN)) 1750 priv->curr_bss_params.bss_descriptor
1756 mwifiex_update_curr_bss_params(priv, 1751 .mac_address, ETH_ALEN))
1757 bssid, rssi, ie_buf, 1752 mwifiex_update_curr_bss_params
1758 ie_len, beacon_period, 1753 (priv, bssid, rssi,
1759 cap_info_bitmap, band); 1754 ie_buf, ie_len,
1755 beacon_period,
1756 cap_info_bitmap, band);
1760 } 1757 }
1761 } else { 1758 } else {
1762 dev_dbg(adapter->dev, "missing BSS channel IE\n"); 1759 dev_dbg(adapter->dev, "missing BSS channel IE\n");
@@ -1783,8 +1780,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
1783 } 1780 }
1784 1781
1785 if (priv->user_scan_cfg) { 1782 if (priv->user_scan_cfg) {
1786 dev_dbg(priv->adapter->dev, "info: %s: sending scan " 1783 dev_dbg(priv->adapter->dev,
1787 "results\n", __func__); 1784 "info: %s: sending scan results\n", __func__);
1788 cfg80211_scan_done(priv->scan_request, 0); 1785 cfg80211_scan_done(priv->scan_request, 0);
1789 priv->scan_request = NULL; 1786 priv->scan_request = NULL;
1790 kfree(priv->user_scan_cfg); 1787 kfree(priv->user_scan_cfg);
@@ -1900,7 +1897,7 @@ int mwifiex_request_scan(struct mwifiex_private *priv,
1900 1897
1901 if (down_interruptible(&priv->async_sem)) { 1898 if (down_interruptible(&priv->async_sem)) {
1902 dev_err(priv->adapter->dev, "%s: acquire semaphore\n", 1899 dev_err(priv->adapter->dev, "%s: acquire semaphore\n",
1903 __func__); 1900 __func__);
1904 return -1; 1901 return -1;
1905 } 1902 }
1906 priv->scan_pending_on_block = true; 1903 priv->scan_pending_on_block = true;
@@ -1985,21 +1982,21 @@ mwifiex_save_curr_bcn(struct mwifiex_private *priv)
1985 1982
1986 /* allocate beacon buffer at 1st time; or if it's size has changed */ 1983 /* allocate beacon buffer at 1st time; or if it's size has changed */
1987 if (!priv->curr_bcn_buf || 1984 if (!priv->curr_bcn_buf ||
1988 priv->curr_bcn_size != curr_bss->beacon_buf_size) { 1985 priv->curr_bcn_size != curr_bss->beacon_buf_size) {
1989 priv->curr_bcn_size = curr_bss->beacon_buf_size; 1986 priv->curr_bcn_size = curr_bss->beacon_buf_size;
1990 1987
1991 kfree(priv->curr_bcn_buf); 1988 kfree(priv->curr_bcn_buf);
1992 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size, 1989 priv->curr_bcn_buf = kmalloc(curr_bss->beacon_buf_size,
1993 GFP_ATOMIC); 1990 GFP_ATOMIC);
1994 if (!priv->curr_bcn_buf) { 1991 if (!priv->curr_bcn_buf) {
1995 dev_err(priv->adapter->dev, 1992 dev_err(priv->adapter->dev,
1996 "failed to alloc curr_bcn_buf\n"); 1993 "failed to alloc curr_bcn_buf\n");
1997 return; 1994 return;
1998 } 1995 }
1999 } 1996 }
2000 1997
2001 memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf, 1998 memcpy(priv->curr_bcn_buf, curr_bss->beacon_buf,
2002 curr_bss->beacon_buf_size); 1999 curr_bss->beacon_buf_size);
2003 dev_dbg(priv->adapter->dev, "info: current beacon saved %d\n", 2000 dev_dbg(priv->adapter->dev, "info: current beacon saved %d\n",
2004 priv->curr_bcn_size); 2001 priv->curr_bcn_size);
2005 2002