Commit 0a50d2b2 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[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: default avatarTakashi Iwai <tiwai@suse.de>
parent f079c25a
...@@ -2877,14 +2877,15 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip) ...@@ -2877,14 +2877,15 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip)
if (chip->region.idx[0].resource) if (chip->region.idx[0].resource)
snd_cs46xx_hw_stop(chip); snd_cs46xx_hw_stop(chip);
if (chip->irq >= 0)
free_irq(chip->irq, chip);
for (idx = 0; idx < 5; idx++) { for (idx = 0; idx < 5; idx++) {
struct snd_cs46xx_region *region = &chip->region.idx[idx]; struct snd_cs46xx_region *region = &chip->region.idx[idx];
if (region->remap_addr) if (region->remap_addr)
iounmap(region->remap_addr); iounmap(region->remap_addr);
release_and_free_resource(region->resource); release_and_free_resource(region->resource);
} }
if (chip->irq >= 0)
free_irq(chip->irq, chip);
if (chip->active_ctrl) if (chip->active_ctrl)
chip->active_ctrl(chip, -chip->amplifier); chip->active_ctrl(chip, -chip->amplifier);
......
...@@ -1836,11 +1836,11 @@ static int snd_riptide_free(struct snd_riptide *chip) ...@@ -1836,11 +1836,11 @@ static int snd_riptide_free(struct snd_riptide *chip)
UNSET_GRESET(cif->hwport); UNSET_GRESET(cif->hwport);
kfree(chip->cif); kfree(chip->cif);
} }
if (chip->irq >= 0)
free_irq(chip->irq, chip);
if (chip->fw_entry) if (chip->fw_entry)
release_firmware(chip->fw_entry); release_firmware(chip->fw_entry);
release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_port);
if (chip->irq >= 0)
free_irq(chip->irq, chip);
kfree(chip); kfree(chip);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment