Skip to content

Commit 736b3a2

Browse files
Sujithlinvjw
Sujith
authored andcommitted
ath9k_hw: fix hardware deinit
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: [email protected] Signed-off-by: Sujith <[email protected]> Signed-off-by: Luis R. Rodriguez <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 05020d2 commit 736b3a2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

drivers/net/wireless/ath/ath9k/hw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ void ath9k_hw_deinit(struct ath_hw *ah)
12271227
{
12281228
struct ath_common *common = ath9k_hw_common(ah);
12291229

1230-
if (common->state <= ATH_HW_INITIALIZED)
1230+
if (common->state < ATH_HW_INITIALIZED)
12311231
goto free_hw;
12321232

12331233
if (!AR_SREV_9100(ah))
@@ -1238,8 +1238,6 @@ void ath9k_hw_deinit(struct ath_hw *ah)
12381238
free_hw:
12391239
if (!AR_SREV_9280_10_OR_LATER(ah))
12401240
ath9k_hw_rf_free_ext_banks(ah);
1241-
kfree(ah);
1242-
ah = NULL;
12431241
}
12441242
EXPORT_SYMBOL(ath9k_hw_deinit);
12451243

drivers/net/wireless/ath/ath9k/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,9 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
758758

759759
tasklet_kill(&sc->intr_tq);
760760
tasklet_kill(&sc->bcon_tasklet);
761+
762+
kfree(sc->sc_ah);
763+
sc->sc_ah = NULL;
761764
}
762765

763766
void ath9k_deinit_device(struct ath_softc *sc)

0 commit comments

Comments
 (0)