[ALSA] Fix possible races in PCI driver removal
authorTakashi Iwai <tiwai@suse.de>
Thu, 1 Jun 2006 12:47:29 +0000 (14:47 +0200)
committerJaroslav Kysela <perex@suse.cz>
Thu, 22 Jun 2006 19:34:08 +0000 (21:34 +0200)
Call free_irq() before releasing others to avoid races when
shared irq is issued.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/riptide/riptide.c

index 69dbf542a6de20a62405c7be4916c17ce7241659..5c2114439204154178adce8c5058e4c2f1deebb9 100644 (file)
@@ -2877,14 +2877,15 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip)
        if (chip->region.idx[0].resource)
                snd_cs46xx_hw_stop(chip);
 
+       if (chip->irq >= 0)
+               free_irq(chip->irq, chip);
+
        for (idx = 0; idx < 5; idx++) {
                struct snd_cs46xx_region *region = &chip->region.idx[idx];
                if (region->remap_addr)
                        iounmap(region->remap_addr);
                release_and_free_resource(region->resource);
        }
-       if (chip->irq >= 0)
-               free_irq(chip->irq, chip);
 
        if (chip->active_ctrl)
                chip->active_ctrl(chip, -chip->amplifier);
index c27cd499977787efb58f74bfb000475ba9361edd..5618ec9740bded1738a034868720d24db46ab239 100644 (file)
@@ -1836,11 +1836,11 @@ static int snd_riptide_free(struct snd_riptide *chip)
                UNSET_GRESET(cif->hwport);
                kfree(chip->cif);
        }
+       if (chip->irq >= 0)
+               free_irq(chip->irq, chip);
        if (chip->fw_entry)
                release_firmware(chip->fw_entry);
        release_and_free_resource(chip->res_port);
-       if (chip->irq >= 0)
-               free_irq(chip->irq, chip);
        kfree(chip);
        return 0;
 }