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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 84be196188cc..b728f54451e4 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -822,7 +822,9 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
822 continue; 822 continue;
823 823
824 rtnl_lock(); 824 rtnl_lock();
825 mwifiex_del_virtual_intf(priv->wdev->wiphy, priv->netdev); 825 if (priv->wdev && priv->netdev)
826 mwifiex_del_virtual_intf(priv->wdev->wiphy,
827 priv->netdev);
826 rtnl_unlock(); 828 rtnl_unlock();
827 } 829 }
828 830
@@ -830,9 +832,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
830 if (!priv) 832 if (!priv)
831 goto exit_remove; 833 goto exit_remove;
832 834
833 wiphy_unregister(priv->wdev->wiphy); 835 if (priv->wdev) {
834 wiphy_free(priv->wdev->wiphy); 836 wiphy_unregister(priv->wdev->wiphy);
835 kfree(priv->wdev); 837 wiphy_free(priv->wdev->wiphy);
838 kfree(priv->wdev);
839 }
836 840
837 mwifiex_terminate_workqueue(adapter); 841 mwifiex_terminate_workqueue(adapter);
838 842