OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / drivers / net / wireless / mwifiex / init.c
blob1d0ec57a0143d8f0a2b15cfbb2220ba065171045
1 /*
2 * Marvell Wireless LAN device driver: HW/FW Initialization
4 * Copyright (C) 2011, Marvell International Ltd.
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
14 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
17 * this warranty disclaimer.
20 #include "decl.h"
21 #include "ioctl.h"
22 #include "util.h"
23 #include "fw.h"
24 #include "main.h"
25 #include "wmm.h"
26 #include "11n.h"
29 * This function adds a BSS priority table to the table list.
31 * The function allocates a new BSS priority table node and adds it to
32 * the end of BSS priority table list, kept in driver memory.
34 static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
36 struct mwifiex_adapter *adapter = priv->adapter;
37 struct mwifiex_bss_prio_node *bss_prio;
38 unsigned long flags;
40 bss_prio = kzalloc(sizeof(struct mwifiex_bss_prio_node), GFP_KERNEL);
41 if (!bss_prio) {
42 dev_err(adapter->dev, "%s: failed to alloc bss_prio\n",
43 __func__);
44 return -ENOMEM;
47 bss_prio->priv = priv;
48 INIT_LIST_HEAD(&bss_prio->list);
49 if (!adapter->bss_prio_tbl[priv->bss_priority].bss_prio_cur)
50 adapter->bss_prio_tbl[priv->bss_priority].bss_prio_cur =
51 bss_prio;
53 spin_lock_irqsave(&adapter->bss_prio_tbl[priv->bss_priority]
54 .bss_prio_lock, flags);
55 list_add_tail(&bss_prio->list,
56 &adapter->bss_prio_tbl[priv->bss_priority]
57 .bss_prio_head);
58 spin_unlock_irqrestore(&adapter->bss_prio_tbl[priv->bss_priority]
59 .bss_prio_lock, flags);
61 return 0;
65 * This function initializes the private structure and sets default
66 * values to the members.
68 * Additionally, it also initializes all the locks and sets up all the
69 * lists.
71 static int mwifiex_init_priv(struct mwifiex_private *priv)
73 u32 i;
75 priv->media_connected = false;
76 memset(priv->curr_addr, 0xff, ETH_ALEN);
78 priv->pkt_tx_ctrl = 0;
79 priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED;
80 priv->data_rate = 0; /* Initially indicate the rate as auto */
81 priv->is_data_rate_auto = true;
82 priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
83 priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
85 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_DISABLED;
86 priv->sec_info.authentication_mode = NL80211_AUTHTYPE_OPEN_SYSTEM;
87 priv->sec_info.encryption_mode = 0;
88 for (i = 0; i < ARRAY_SIZE(priv->wep_key); i++)
89 memset(&priv->wep_key[i], 0, sizeof(struct mwifiex_wep_key));
90 priv->wep_key_curr_index = 0;
91 priv->curr_pkt_filter = HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON |
92 HostCmd_ACT_MAC_ETHERNETII_ENABLE;
94 priv->beacon_period = 100; /* beacon interval */ ;
95 priv->attempted_bss_desc = NULL;
96 memset(&priv->curr_bss_params, 0, sizeof(priv->curr_bss_params));
97 priv->listen_interval = MWIFIEX_DEFAULT_LISTEN_INTERVAL;
99 memset(&priv->prev_ssid, 0, sizeof(priv->prev_ssid));
100 memset(&priv->prev_bssid, 0, sizeof(priv->prev_bssid));
101 memset(&priv->assoc_rsp_buf, 0, sizeof(priv->assoc_rsp_buf));
102 priv->assoc_rsp_size = 0;
103 priv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL;
104 priv->atim_window = 0;
105 priv->adhoc_state = ADHOC_IDLE;
106 priv->tx_power_level = 0;
107 priv->max_tx_power_level = 0;
108 priv->min_tx_power_level = 0;
109 priv->tx_rate = 0;
110 priv->rxpd_htinfo = 0;
111 priv->rxpd_rate = 0;
112 priv->rate_bitmap = 0;
113 priv->data_rssi_last = 0;
114 priv->data_rssi_avg = 0;
115 priv->data_nf_avg = 0;
116 priv->data_nf_last = 0;
117 priv->bcn_rssi_last = 0;
118 priv->bcn_rssi_avg = 0;
119 priv->bcn_nf_avg = 0;
120 priv->bcn_nf_last = 0;
121 memset(&priv->wpa_ie, 0, sizeof(priv->wpa_ie));
122 memset(&priv->aes_key, 0, sizeof(priv->aes_key));
123 priv->wpa_ie_len = 0;
124 priv->wpa_is_gtk_set = false;
126 memset(&priv->assoc_tlv_buf, 0, sizeof(priv->assoc_tlv_buf));
127 priv->assoc_tlv_buf_len = 0;
128 memset(&priv->wps, 0, sizeof(priv->wps));
129 memset(&priv->gen_ie_buf, 0, sizeof(priv->gen_ie_buf));
130 priv->gen_ie_buf_len = 0;
131 memset(priv->vs_ie, 0, sizeof(priv->vs_ie));
133 priv->wmm_required = true;
134 priv->wmm_enabled = false;
135 priv->wmm_qosinfo = 0;
136 priv->curr_bcn_buf = NULL;
137 priv->curr_bcn_size = 0;
139 priv->scan_block = false;
141 return mwifiex_add_bss_prio_tbl(priv);
145 * This function allocates buffers for members of the adapter
146 * structure.
148 * The memory allocated includes scan table, command buffers, and
149 * sleep confirm command buffer. In addition, the queues are
150 * also initialized.
152 static int mwifiex_allocate_adapter(struct mwifiex_adapter *adapter)
154 int ret;
156 /* Allocate command buffer */
157 ret = mwifiex_alloc_cmd_buffer(adapter);
158 if (ret) {
159 dev_err(adapter->dev, "%s: failed to alloc cmd buffer\n",
160 __func__);
161 return -1;
164 adapter->sleep_cfm =
165 dev_alloc_skb(sizeof(struct mwifiex_opt_sleep_confirm)
166 + INTF_HEADER_LEN);
168 if (!adapter->sleep_cfm) {
169 dev_err(adapter->dev, "%s: failed to alloc sleep cfm"
170 " cmd buffer\n", __func__);
171 return -1;
173 skb_reserve(adapter->sleep_cfm, INTF_HEADER_LEN);
175 return 0;
179 * This function initializes the adapter structure and sets default
180 * values to the members of adapter.
182 * This also initializes the WMM related parameters in the driver private
183 * structures.
185 static void mwifiex_init_adapter(struct mwifiex_adapter *adapter)
187 struct mwifiex_opt_sleep_confirm *sleep_cfm_buf = NULL;
189 skb_put(adapter->sleep_cfm, sizeof(struct mwifiex_opt_sleep_confirm));
191 adapter->cmd_sent = false;
193 if (adapter->iface_type == MWIFIEX_PCIE)
194 adapter->data_sent = false;
195 else
196 adapter->data_sent = true;
198 adapter->cmd_resp_received = false;
199 adapter->event_received = false;
200 adapter->data_received = false;
202 adapter->surprise_removed = false;
204 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING;
206 adapter->ps_mode = MWIFIEX_802_11_POWER_MODE_CAM;
207 adapter->ps_state = PS_STATE_AWAKE;
208 adapter->need_to_wakeup = false;
210 adapter->scan_mode = HostCmd_BSS_MODE_ANY;
211 adapter->specific_scan_time = MWIFIEX_SPECIFIC_SCAN_CHAN_TIME;
212 adapter->active_scan_time = MWIFIEX_ACTIVE_SCAN_CHAN_TIME;
213 adapter->passive_scan_time = MWIFIEX_PASSIVE_SCAN_CHAN_TIME;
215 adapter->scan_probes = 1;
217 adapter->multiple_dtim = 1;
219 adapter->local_listen_interval = 0; /* default value in firmware
220 will be used */
222 adapter->is_deep_sleep = false;
224 adapter->delay_null_pkt = false;
225 adapter->delay_to_ps = 1000;
226 adapter->enhanced_ps_mode = PS_MODE_AUTO;
228 adapter->gen_null_pkt = false; /* Disable NULL Pkg generation by
229 default */
230 adapter->pps_uapsd_mode = false; /* Disable pps/uapsd mode by
231 default */
232 adapter->pm_wakeup_card_req = false;
234 adapter->pm_wakeup_fw_try = false;
236 adapter->max_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K;
237 adapter->tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K;
238 adapter->curr_tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K;
240 adapter->is_hs_configured = false;
241 adapter->hs_cfg.conditions = cpu_to_le32(HOST_SLEEP_CFG_COND_DEF);
242 adapter->hs_cfg.gpio = HOST_SLEEP_CFG_GPIO_DEF;
243 adapter->hs_cfg.gap = HOST_SLEEP_CFG_GAP_DEF;
244 adapter->hs_activated = false;
246 memset(adapter->event_body, 0, sizeof(adapter->event_body));
247 adapter->hw_dot_11n_dev_cap = 0;
248 adapter->hw_dev_mcs_support = 0;
249 adapter->sec_chan_offset = 0;
250 adapter->adhoc_11n_enabled = false;
252 mwifiex_wmm_init(adapter);
254 if (adapter->sleep_cfm) {
255 sleep_cfm_buf = (struct mwifiex_opt_sleep_confirm *)
256 adapter->sleep_cfm->data;
257 memset(sleep_cfm_buf, 0, adapter->sleep_cfm->len);
258 sleep_cfm_buf->command =
259 cpu_to_le16(HostCmd_CMD_802_11_PS_MODE_ENH);
260 sleep_cfm_buf->size =
261 cpu_to_le16(adapter->sleep_cfm->len);
262 sleep_cfm_buf->result = 0;
263 sleep_cfm_buf->action = cpu_to_le16(SLEEP_CONFIRM);
264 sleep_cfm_buf->resp_ctrl = cpu_to_le16(RESP_NEEDED);
266 memset(&adapter->sleep_params, 0, sizeof(adapter->sleep_params));
267 memset(&adapter->sleep_period, 0, sizeof(adapter->sleep_period));
268 adapter->tx_lock_flag = false;
269 adapter->null_pkt_interval = 0;
270 adapter->fw_bands = 0;
271 adapter->config_bands = 0;
272 adapter->adhoc_start_band = 0;
273 adapter->scan_channels = NULL;
274 adapter->fw_release_number = 0;
275 adapter->fw_cap_info = 0;
276 memset(&adapter->upld_buf, 0, sizeof(adapter->upld_buf));
277 adapter->event_cause = 0;
278 adapter->region_code = 0;
279 adapter->bcn_miss_time_out = DEFAULT_BCN_MISS_TIMEOUT;
280 adapter->adhoc_awake_period = 0;
281 memset(&adapter->arp_filter, 0, sizeof(adapter->arp_filter));
282 adapter->arp_filter_size = 0;
286 * This function sets trans_start per tx_queue
288 void mwifiex_set_trans_start(struct net_device *dev)
290 int i;
292 for (i = 0; i < dev->num_tx_queues; i++)
293 netdev_get_tx_queue(dev, i)->trans_start = jiffies;
295 dev->trans_start = jiffies;
299 * This function wakes up all queues in net_device
301 void mwifiex_wake_up_net_dev_queue(struct net_device *netdev,
302 struct mwifiex_adapter *adapter)
304 unsigned long dev_queue_flags;
306 spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags);
307 netif_tx_wake_all_queues(netdev);
308 spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags);
312 * This function stops all queues in net_device
314 void mwifiex_stop_net_dev_queue(struct net_device *netdev,
315 struct mwifiex_adapter *adapter)
317 unsigned long dev_queue_flags;
319 spin_lock_irqsave(&adapter->queue_lock, dev_queue_flags);
320 netif_tx_stop_all_queues(netdev);
321 spin_unlock_irqrestore(&adapter->queue_lock, dev_queue_flags);
325 * This function releases the lock variables and frees the locks and
326 * associated locks.
328 static void mwifiex_free_lock_list(struct mwifiex_adapter *adapter)
330 struct mwifiex_private *priv;
331 s32 i, j;
333 /* Free lists */
334 list_del(&adapter->cmd_free_q);
335 list_del(&adapter->cmd_pending_q);
336 list_del(&adapter->scan_pending_q);
338 for (i = 0; i < adapter->priv_num; i++)
339 list_del(&adapter->bss_prio_tbl[i].bss_prio_head);
341 for (i = 0; i < adapter->priv_num; i++) {
342 if (adapter->priv[i]) {
343 priv = adapter->priv[i];
344 for (j = 0; j < MAX_NUM_TID; ++j)
345 list_del(&priv->wmm.tid_tbl_ptr[j].ra_list);
346 list_del(&priv->tx_ba_stream_tbl_ptr);
347 list_del(&priv->rx_reorder_tbl_ptr);
353 * This function frees the adapter structure.
355 * The freeing operation is done recursively, by canceling all
356 * pending commands, freeing the member buffers previously
357 * allocated (command buffers, scan table buffer, sleep confirm
358 * command buffer), stopping the timers and calling the cleanup
359 * routines for every interface, before the actual adapter
360 * structure is freed.
362 static void
363 mwifiex_free_adapter(struct mwifiex_adapter *adapter)
365 if (!adapter) {
366 pr_err("%s: adapter is NULL\n", __func__);
367 return;
370 mwifiex_cancel_all_pending_cmd(adapter);
372 /* Free lock variables */
373 mwifiex_free_lock_list(adapter);
375 /* Free command buffer */
376 dev_dbg(adapter->dev, "info: free cmd buffer\n");
377 mwifiex_free_cmd_buffer(adapter);
379 del_timer(&adapter->cmd_timer);
381 dev_dbg(adapter->dev, "info: free scan table\n");
383 adapter->if_ops.cleanup_if(adapter);
385 if (adapter->sleep_cfm)
386 dev_kfree_skb_any(adapter->sleep_cfm);
390 * This function intializes the lock variables and
391 * the list heads.
393 int mwifiex_init_lock_list(struct mwifiex_adapter *adapter)
395 struct mwifiex_private *priv;
396 s32 i, j;
398 spin_lock_init(&adapter->mwifiex_lock);
399 spin_lock_init(&adapter->int_lock);
400 spin_lock_init(&adapter->main_proc_lock);
401 spin_lock_init(&adapter->mwifiex_cmd_lock);
402 spin_lock_init(&adapter->queue_lock);
403 for (i = 0; i < adapter->priv_num; i++) {
404 if (adapter->priv[i]) {
405 priv = adapter->priv[i];
406 spin_lock_init(&priv->rx_pkt_lock);
407 spin_lock_init(&priv->wmm.ra_list_spinlock);
408 spin_lock_init(&priv->curr_bcn_buf_lock);
412 /* Initialize cmd_free_q */
413 INIT_LIST_HEAD(&adapter->cmd_free_q);
414 /* Initialize cmd_pending_q */
415 INIT_LIST_HEAD(&adapter->cmd_pending_q);
416 /* Initialize scan_pending_q */
417 INIT_LIST_HEAD(&adapter->scan_pending_q);
419 spin_lock_init(&adapter->cmd_free_q_lock);
420 spin_lock_init(&adapter->cmd_pending_q_lock);
421 spin_lock_init(&adapter->scan_pending_q_lock);
423 for (i = 0; i < adapter->priv_num; ++i) {
424 INIT_LIST_HEAD(&adapter->bss_prio_tbl[i].bss_prio_head);
425 adapter->bss_prio_tbl[i].bss_prio_cur = NULL;
426 spin_lock_init(&adapter->bss_prio_tbl[i].bss_prio_lock);
429 for (i = 0; i < adapter->priv_num; i++) {
430 if (!adapter->priv[i])
431 continue;
432 priv = adapter->priv[i];
433 for (j = 0; j < MAX_NUM_TID; ++j) {
434 INIT_LIST_HEAD(&priv->wmm.tid_tbl_ptr[j].ra_list);
435 spin_lock_init(&priv->wmm.tid_tbl_ptr[j].tid_tbl_lock);
437 INIT_LIST_HEAD(&priv->tx_ba_stream_tbl_ptr);
438 INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr);
440 spin_lock_init(&priv->tx_ba_stream_tbl_lock);
441 spin_lock_init(&priv->rx_reorder_tbl_lock);
444 return 0;
448 * This function initializes the firmware.
450 * The following operations are performed sequentially -
451 * - Allocate adapter structure
452 * - Initialize the adapter structure
453 * - Initialize the private structure
454 * - Add BSS priority tables to the adapter structure
455 * - For each interface, send the init commands to firmware
456 * - Send the first command in command pending queue, if available
458 int mwifiex_init_fw(struct mwifiex_adapter *adapter)
460 int ret;
461 struct mwifiex_private *priv;
462 u8 i, first_sta = true;
463 int is_cmd_pend_q_empty;
464 unsigned long flags;
466 adapter->hw_status = MWIFIEX_HW_STATUS_INITIALIZING;
468 /* Allocate memory for member of adapter structure */
469 ret = mwifiex_allocate_adapter(adapter);
470 if (ret)
471 return -1;
473 /* Initialize adapter structure */
474 mwifiex_init_adapter(adapter);
476 for (i = 0; i < adapter->priv_num; i++) {
477 if (adapter->priv[i]) {
478 priv = adapter->priv[i];
480 /* Initialize private structure */
481 ret = mwifiex_init_priv(priv);
482 if (ret)
483 return -1;
486 for (i = 0; i < adapter->priv_num; i++) {
487 if (adapter->priv[i]) {
488 ret = mwifiex_sta_init_cmd(adapter->priv[i], first_sta);
489 if (ret == -1)
490 return -1;
492 first_sta = false;
496 spin_lock_irqsave(&adapter->cmd_pending_q_lock, flags);
497 is_cmd_pend_q_empty = list_empty(&adapter->cmd_pending_q);
498 spin_unlock_irqrestore(&adapter->cmd_pending_q_lock, flags);
499 if (!is_cmd_pend_q_empty) {
500 /* Send the first command in queue and return */
501 if (mwifiex_main_process(adapter) != -1)
502 ret = -EINPROGRESS;
503 } else {
504 adapter->hw_status = MWIFIEX_HW_STATUS_READY;
507 return ret;
511 * This function deletes the BSS priority tables.
513 * The function traverses through all the allocated BSS priority nodes
514 * in every BSS priority table and frees them.
516 static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv)
518 int i;
519 struct mwifiex_adapter *adapter = priv->adapter;
520 struct mwifiex_bss_prio_node *bssprio_node, *tmp_node, **cur;
521 struct list_head *head;
522 spinlock_t *lock;
523 unsigned long flags;
525 for (i = 0; i < adapter->priv_num; ++i) {
526 head = &adapter->bss_prio_tbl[i].bss_prio_head;
527 cur = &adapter->bss_prio_tbl[i].bss_prio_cur;
528 lock = &adapter->bss_prio_tbl[i].bss_prio_lock;
529 dev_dbg(adapter->dev, "info: delete BSS priority table,"
530 " index = %d, i = %d, head = %p, cur = %p\n",
531 priv->bss_index, i, head, *cur);
532 if (*cur) {
533 spin_lock_irqsave(lock, flags);
534 if (list_empty(head)) {
535 spin_unlock_irqrestore(lock, flags);
536 continue;
538 bssprio_node = list_first_entry(head,
539 struct mwifiex_bss_prio_node, list);
540 spin_unlock_irqrestore(lock, flags);
542 list_for_each_entry_safe(bssprio_node, tmp_node, head,
543 list) {
544 if (bssprio_node->priv == priv) {
545 dev_dbg(adapter->dev, "info: Delete "
546 "node %p, next = %p\n",
547 bssprio_node, tmp_node);
548 spin_lock_irqsave(lock, flags);
549 list_del(&bssprio_node->list);
550 spin_unlock_irqrestore(lock, flags);
551 kfree(bssprio_node);
554 *cur = (struct mwifiex_bss_prio_node *)head;
560 * This function is used to shutdown the driver.
562 * The following operations are performed sequentially -
563 * - Check if already shut down
564 * - Make sure the main process has stopped
565 * - Clean up the Tx and Rx queues
566 * - Delete BSS priority tables
567 * - Free the adapter
568 * - Notify completion
571 mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
573 int ret = -EINPROGRESS;
574 struct mwifiex_private *priv;
575 s32 i;
576 unsigned long flags;
578 /* mwifiex already shutdown */
579 if (adapter->hw_status == MWIFIEX_HW_STATUS_NOT_READY)
580 return 0;
582 adapter->hw_status = MWIFIEX_HW_STATUS_CLOSING;
583 /* wait for mwifiex_process to complete */
584 if (adapter->mwifiex_processing) {
585 dev_warn(adapter->dev, "main process is still running\n");
586 return ret;
589 /* shut down mwifiex */
590 dev_dbg(adapter->dev, "info: shutdown mwifiex...\n");
592 /* Clean up Tx/Rx queues and delete BSS priority table */
593 for (i = 0; i < adapter->priv_num; i++) {
594 if (adapter->priv[i]) {
595 priv = adapter->priv[i];
597 mwifiex_clean_txrx(priv);
598 mwifiex_delete_bss_prio_tbl(priv);
602 spin_lock_irqsave(&adapter->mwifiex_lock, flags);
604 /* Free adapter structure */
605 mwifiex_free_adapter(adapter);
607 spin_unlock_irqrestore(&adapter->mwifiex_lock, flags);
609 /* Notify completion */
610 ret = mwifiex_shutdown_fw_complete(adapter);
612 return ret;
616 * This function downloads the firmware to the card.
618 * The actual download is preceded by two sanity checks -
619 * - Check if firmware is already running
620 * - Check if the interface is the winner to download the firmware
622 * ...and followed by another -
623 * - Check if the firmware is downloaded successfully
625 * After download is successfully completed, the host interrupts are enabled.
627 int mwifiex_dnld_fw(struct mwifiex_adapter *adapter,
628 struct mwifiex_fw_image *pmfw)
630 int ret;
631 u32 poll_num = 1;
633 adapter->winner = 0;
635 /* Check if firmware is already running */
636 ret = adapter->if_ops.check_fw_status(adapter, poll_num);
637 if (!ret) {
638 dev_notice(adapter->dev,
639 "WLAN FW already running! Skip FW download\n");
640 goto done;
642 poll_num = MAX_FIRMWARE_POLL_TRIES;
644 /* Check if we are the winner for downloading FW */
645 if (!adapter->winner) {
646 dev_notice(adapter->dev,
647 "Other interface already running!"
648 " Skip FW download\n");
649 poll_num = MAX_MULTI_INTERFACE_POLL_TRIES;
650 goto poll_fw;
652 if (pmfw) {
653 /* Download firmware with helper */
654 ret = adapter->if_ops.prog_fw(adapter, pmfw);
655 if (ret) {
656 dev_err(adapter->dev, "prog_fw failed ret=%#x\n", ret);
657 return ret;
661 poll_fw:
662 /* Check if the firmware is downloaded successfully or not */
663 ret = adapter->if_ops.check_fw_status(adapter, poll_num);
664 if (ret) {
665 dev_err(adapter->dev, "FW failed to be active in time\n");
666 return -1;
668 done:
669 /* re-enable host interrupt for mwifiex after fw dnld is successful */
670 adapter->if_ops.enable_int(adapter);
671 return ret;