aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mwifiex/main.c')
-rw-r--r--drivers/net/wireless/mwifiex/main.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 9d7c9d354d34..78e8a6666cc6 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -411,13 +411,14 @@ static void mwifiex_terminate_workqueue(struct mwifiex_adapter *adapter)
411 */ 411 */
412static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) 412static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
413{ 413{
414 int ret, i; 414 int ret;
415 char fmt[64]; 415 char fmt[64];
416 struct mwifiex_private *priv; 416 struct mwifiex_private *priv;
417 struct mwifiex_adapter *adapter = context; 417 struct mwifiex_adapter *adapter = context;
418 struct mwifiex_fw_image fw; 418 struct mwifiex_fw_image fw;
419 struct semaphore *sem = adapter->card_sem; 419 struct semaphore *sem = adapter->card_sem;
420 bool init_failed = false; 420 bool init_failed = false;
421 struct wireless_dev *wdev;
421 422
422 if (!firmware) { 423 if (!firmware) {
423 dev_err(adapter->dev, 424 dev_err(adapter->dev,
@@ -469,14 +470,16 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
469 priv = adapter->priv[MWIFIEX_BSS_ROLE_STA]; 470 priv = adapter->priv[MWIFIEX_BSS_ROLE_STA];
470 if (mwifiex_register_cfg80211(adapter)) { 471 if (mwifiex_register_cfg80211(adapter)) {
471 dev_err(adapter->dev, "cannot register with cfg80211\n"); 472 dev_err(adapter->dev, "cannot register with cfg80211\n");
472 goto err_register_cfg80211; 473 goto err_init_fw;
473 } 474 }
474 475
475 rtnl_lock(); 476 rtnl_lock();
476 /* Create station interface by default */ 477 /* Create station interface by default */
477 if (!mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d", 478 wdev = mwifiex_add_virtual_intf(adapter->wiphy, "mlan%d",
478 NL80211_IFTYPE_STATION, NULL, NULL)) { 479 NL80211_IFTYPE_STATION, NULL, NULL);
480 if (IS_ERR(wdev)) {
479 dev_err(adapter->dev, "cannot create default STA interface\n"); 481 dev_err(adapter->dev, "cannot create default STA interface\n");
482 rtnl_unlock();
480 goto err_add_intf; 483 goto err_add_intf;
481 } 484 }
482 rtnl_unlock(); 485 rtnl_unlock();
@@ -486,17 +489,6 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context)
486 goto done; 489 goto done;
487 490
488err_add_intf: 491err_add_intf:
489 for (i = 0; i < adapter->priv_num; i++) {
490 priv = adapter->priv[i];
491
492 if (!priv)
493 continue;
494
495 if (priv->wdev && priv->netdev)
496 mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev);
497 }
498 rtnl_unlock();
499err_register_cfg80211:
500 wiphy_unregister(adapter->wiphy); 492 wiphy_unregister(adapter->wiphy);
501 wiphy_free(adapter->wiphy); 493 wiphy_free(adapter->wiphy);
502err_init_fw: 494err_init_fw:
@@ -1006,12 +998,6 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
1006 wiphy_unregister(priv->wdev->wiphy); 998 wiphy_unregister(priv->wdev->wiphy);
1007 wiphy_free(priv->wdev->wiphy); 999 wiphy_free(priv->wdev->wiphy);
1008 1000
1009 for (i = 0; i < adapter->priv_num; i++) {
1010 priv = adapter->priv[i];
1011 if (priv)
1012 kfree(priv->wdev);
1013 }
1014
1015 mwifiex_terminate_workqueue(adapter); 1001 mwifiex_terminate_workqueue(adapter);
1016 1002
1017 /* Unregister device */ 1003 /* Unregister device */