diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-06-01 08:47:29 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-06-22 15:34:08 -0400 |
commit | 0a50d2b2951cb7ae12726814f9a198e1c699aa0b (patch) | |
tree | 38197874a92ead9bf652732d2dc03ecafe3bfdaf | |
parent | f079c25ab8a7d223875c5bac9b23b484e4a18f88 (diff) |
[ALSA] Fix possible races in PCI driver removal
Call free_irq() before releasing others to avoid races when
shared irq is issued.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 5 | ||||
-rw-r--r-- | sound/pci/riptide/riptide.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 69dbf542a6de..5c2114439204 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -2877,14 +2877,15 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) | |||
2877 | if (chip->region.idx[0].resource) | 2877 | if (chip->region.idx[0].resource) |
2878 | snd_cs46xx_hw_stop(chip); | 2878 | snd_cs46xx_hw_stop(chip); |
2879 | 2879 | ||
2880 | if (chip->irq >= 0) | ||
2881 | free_irq(chip->irq, chip); | ||
2882 | |||
2880 | for (idx = 0; idx < 5; idx++) { | 2883 | for (idx = 0; idx < 5; idx++) { |
2881 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; | 2884 | struct snd_cs46xx_region *region = &chip->region.idx[idx]; |
2882 | if (region->remap_addr) | 2885 | if (region->remap_addr) |
2883 | iounmap(region->remap_addr); | 2886 | iounmap(region->remap_addr); |
2884 | release_and_free_resource(region->resource); | 2887 | release_and_free_resource(region->resource); |
2885 | } | 2888 | } |
2886 | if (chip->irq >= 0) | ||
2887 | free_irq(chip->irq, chip); | ||
2888 | 2889 | ||
2889 | if (chip->active_ctrl) | 2890 | if (chip->active_ctrl) |
2890 | chip->active_ctrl(chip, -chip->amplifier); | 2891 | chip->active_ctrl(chip, -chip->amplifier); |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index c27cd4999777..5618ec9740bd 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -1836,11 +1836,11 @@ static int snd_riptide_free(struct snd_riptide *chip) | |||
1836 | UNSET_GRESET(cif->hwport); | 1836 | UNSET_GRESET(cif->hwport); |
1837 | kfree(chip->cif); | 1837 | kfree(chip->cif); |
1838 | } | 1838 | } |
1839 | if (chip->irq >= 0) | ||
1840 | free_irq(chip->irq, chip); | ||
1839 | if (chip->fw_entry) | 1841 | if (chip->fw_entry) |
1840 | release_firmware(chip->fw_entry); | 1842 | release_firmware(chip->fw_entry); |
1841 | release_and_free_resource(chip->res_port); | 1843 | release_and_free_resource(chip->res_port); |
1842 | if (chip->irq >= 0) | ||
1843 | free_irq(chip->irq, chip); | ||
1844 | kfree(chip); | 1844 | kfree(chip); |
1845 | return 0; | 1845 | return 0; |
1846 | } | 1846 | } |