ath9k: Fix panic on driver load
authorSujith <Sujith.Manoharan@atheros.com>
Thu, 14 Jan 2010 04:50:57 +0000 (10:20 +0530)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 14 Jan 2010 23:16:55 +0000 (18:16 -0500)
The device has to be marked as invalid before
registering the ISR. HW initialization takes place
after the ISR has been registered, and the invalid
flag is eventually cleared in the ->stop() callback.

Reported-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ahb.c
drivers/net/wireless/ath/ath9k/init.c
drivers/net/wireless/ath/ath9k/pci.c

index f24b1f4c3e294626541ac0b91c796eae0000fba4..9e62a569e816bf59ba7307647149701faf0354c5 100644 (file)
@@ -121,6 +121,9 @@ static int ath_ahb_probe(struct platform_device *pdev)
        sc->mem = mem;
        sc->irq = irq;
 
+       /* Will be cleared in ath9k_start() */
+       sc->sc_flags |= SC_OP_INVALID;
+
        ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc);
        if (ret) {
                dev_err(&pdev->dev, "request_irq failed\n");
index 16d1efb4b8b279908f5f09f5e38a7ebd7516a2f8..5f78d7a5ff226fe5d1085b22d266bd76f333d1fa 100644 (file)
@@ -534,8 +534,6 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
        int ret = 0, i;
        int csz = 0;
 
-       sc->sc_flags |= SC_OP_INVALID;
-
        ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
        if (!ah)
                return -ENOMEM;
index 95b9a07597efc4ad7fe9ca60f2220237f1cac498..4ae7b5f120299848492892a5dfc92f9e901fedd9 100644 (file)
@@ -198,6 +198,9 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        sc->dev = &pdev->dev;
        sc->mem = mem;
 
+       /* Will be cleared in ath9k_start() */
+       sc->sc_flags |= SC_OP_INVALID;
+
        ret = request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath9k", sc);
        if (ret) {
                dev_err(&pdev->dev, "request_irq failed\n");