atheros: fix propagation of bad EEPROM on regulatory init
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Tue, 14 Apr 2009 01:41:46 +0000 (21:41 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 22 Apr 2009 20:57:15 +0000 (16:57 -0400)
When the EEPROM is not in good condition we cannot continue so
we currently bail out but only ath5k is bailing out properly.
Both ath9k and ar9170 were proceeding and if a user were to run
into this they'd see an obscure panic. Lets propagate the error
as intended and make sure we inform the user by lifting the
error message from debug to a kernel error.

Stable note: You can find a port of this page here:

http://bombadil.infradead.org/~mcgrof/patches/ath9k/ath9k-fix-eeprom.patch.txt

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

index 8de0ff9f580b129928a484a78686b040babf7e5b..857416c80199117c78fee398cfe8cd0a220ccd48 100644 (file)
@@ -1649,6 +1649,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
 
        err = ath_regd_init(&ar->regulatory, ar->hw->wiphy,
                            ar9170_reg_notifier);
+       if (err)
+               goto err_out;
 
        err = ieee80211_register_hw(ar->hw);
        if (err)
index 8bf2bf36fd6d37833e16f9d047afb062925f06f4..2398d4f45f28c87127daf31f060462ebb67c0173 100644 (file)
@@ -1416,8 +1416,9 @@ static int ath_init(u16 devid, struct ath_softc *sc)
        for (i = 0; i < sc->keymax; i++)
                ath9k_hw_keyreset(ah, (u16) i);
 
-       if (ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
-                         ath9k_reg_notifier))
+       error = ath_regd_init(&sc->sc_ah->regulatory, sc->hw->wiphy,
+                             ath9k_reg_notifier);
+       if (error)
                goto bad;
 
        /* default to MONITOR mode */
index 4b5c851b81ff1bc7f32b0a683e4ea45c6827b3d4..526c7f1308db96c48ade31b0f4884562c53c564c 100644 (file)
@@ -477,7 +477,7 @@ ath_regd_init(struct ath_regulatory *reg,
        u16 regdmn;
 
        if (!ath_regd_is_eeprom_valid(reg)) {
-               printk(KERN_DEBUG "ath: Invalid EEPROM contents\n");
+               printk(KERN_ERR "ath: Invalid EEPROM contents\n");
                return -EINVAL;
        }