ath9k_hw: fix hardware deinit
authorSujith <Sujith.Manoharan@atheros.com>
Wed, 17 Mar 2010 08:55:24 +0000 (14:25 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 23 Mar 2010 20:50:16 +0000 (16:50 -0400)
Without this you will get a panic if the device initialization
fails. Also, free ath_hw instance properly. ath9k_hw_deinit()
shouldn't do it.

Cc: stable@kernel.org
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/init.c

index 05aeb511c686f1589f24d6bdd56995abba739235..77db932c3137febc4632f8cb549fc97dcf251fa3 100644 (file)
@@ -1227,7 +1227,7 @@ void ath9k_hw_deinit(struct ath_hw *ah)
 {
        struct ath_common *common = ath9k_hw_common(ah);
 
-       if (common->state <= ATH_HW_INITIALIZED)
+       if (common->state < ATH_HW_INITIALIZED)
                goto free_hw;
 
        if (!AR_SREV_9100(ah))
@@ -1238,8 +1238,6 @@ void ath9k_hw_deinit(struct ath_hw *ah)
 free_hw:
        if (!AR_SREV_9280_10_OR_LATER(ah))
                ath9k_hw_rf_free_ext_banks(ah);
-       kfree(ah);
-       ah = NULL;
 }
 EXPORT_SYMBOL(ath9k_hw_deinit);
 
index 623c2f884987fbc25502dab79bf06132e84a24c1..6063f5463708e3ee5ab1264ba0c16fcf6a3978e9 100644 (file)
@@ -758,6 +758,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 
        tasklet_kill(&sc->intr_tq);
        tasklet_kill(&sc->bcon_tasklet);
+
+       kfree(sc->sc_ah);
+       sc->sc_ah = NULL;
 }
 
 void ath9k_deinit_device(struct ath_softc *sc)