wcn36xx: Don't use the destroyed hal_mutex
authorBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 11 Jan 2017 14:32:21 +0000 (16:32 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 12 Jan 2017 10:43:59 +0000 (12:43 +0200)
ieee80211_unregister_hw() might invoke operations to stop the interface,
that uses the hal_mutex. So don't destroy it until after we're done
using it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wcn36xx/main.c

index 96a9584..0002190 100644 (file)
@@ -1241,7 +1241,6 @@ static int wcn36xx_remove(struct platform_device *pdev)
        wcn36xx_dbg(WCN36XX_DBG_MAC, "platform remove\n");
 
        release_firmware(wcn->nv);
-       mutex_destroy(&wcn->hal_mutex);
 
        ieee80211_unregister_hw(hw);
 
@@ -1250,6 +1249,8 @@ static int wcn36xx_remove(struct platform_device *pdev)
 
        iounmap(wcn->dxe_base);
        iounmap(wcn->ccu_base);
+
+       mutex_destroy(&wcn->hal_mutex);
        ieee80211_free_hw(hw);
 
        return 0;