]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ath9k_hw: fix hardware deinit
authorSujith <Sujith.Manoharan@atheros.com>
Wed, 17 Mar 2010 08:55:24 +0000 (14:25 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:22:14 +0000 (11:22 -0700)
commit 736b3a27b3c50c4a23717b802240435a69e8d0ff upstream.

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/net/wireless/ath/ath9k/hw.c
drivers/net/wireless/ath/ath9k/init.c

index 78b571129c92a57e8cf921f7f02040aa0f47b959..20d5414c0d134aac558a9bdf59c7e0c4cda4a42b 100644 (file)
@@ -1241,7 +1241,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))
@@ -1252,8 +1252,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 3d4d897add6d9bc07f250dcee458633e4ae7355f..b78308c3c4d4ccdc29bcd0b73c03a06c95e3cff7 100644 (file)
@@ -760,6 +760,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)