Commit 688956f2 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Fix races in irq handler and ioremap

Call ioremap before request_irq for avoiding possible races
in the irq handler.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c5533bf3
...@@ -1379,20 +1379,20 @@ static int __devinit snd_cs4281_create(struct snd_card *card, ...@@ -1379,20 +1379,20 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
chip->ba0_addr = pci_resource_start(pci, 0); chip->ba0_addr = pci_resource_start(pci, 0);
chip->ba1_addr = pci_resource_start(pci, 1); chip->ba1_addr = pci_resource_start(pci, 1);
if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ, chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
"CS4281", chip)) { chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); if (!chip->ba0 || !chip->ba1) {
snd_cs4281_free(chip); snd_cs4281_free(chip);
return -ENOMEM; return -ENOMEM;
} }
chip->irq = pci->irq;
chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0)); if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ,
chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1)); "CS4281", chip)) {
if (!chip->ba0 || !chip->ba1) { snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
snd_cs4281_free(chip); snd_cs4281_free(chip);
return -ENOMEM; return -ENOMEM;
} }
chip->irq = pci->irq;
tmp = snd_cs4281_chip_init(chip); tmp = snd_cs4281_chip_init(chip);
if (tmp) { if (tmp) {
......
...@@ -1368,18 +1368,18 @@ static int __devinit snd_rme32_create(struct rme32 * rme32) ...@@ -1368,18 +1368,18 @@ static int __devinit snd_rme32_create(struct rme32 * rme32)
return err; return err;
rme32->port = pci_resource_start(rme32->pci, 0); rme32->port = pci_resource_start(rme32->pci, 0);
if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
return -EBUSY;
}
rme32->irq = pci->irq;
if ((rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE)) == 0) { if ((rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE)) == 0) {
snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n",
rme32->port, rme32->port + RME32_IO_SIZE - 1); rme32->port, rme32->port + RME32_IO_SIZE - 1);
return -ENOMEM; return -ENOMEM;
} }
if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
return -EBUSY;
}
rme32->irq = pci->irq;
/* read the card's revision number */ /* read the card's revision number */
pci_read_config_byte(pci, 8, &rme32->rev); pci_read_config_byte(pci, 8, &rme32->rev);
......
...@@ -1583,17 +1583,17 @@ snd_rme96_create(struct rme96 *rme96) ...@@ -1583,17 +1583,17 @@ snd_rme96_create(struct rme96 *rme96)
return err; return err;
rme96->port = pci_resource_start(rme96->pci, 0); rme96->port = pci_resource_start(rme96->pci, 0);
if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
return -ENOMEM;
}
if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) { if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
return -EBUSY; return -EBUSY;
} }
rme96->irq = pci->irq; rme96->irq = pci->irq;
if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
return -ENOMEM;
}
/* read the card's revision number */ /* read the card's revision number */
pci_read_config_byte(pci, 8, &rme96->rev); pci_read_config_byte(pci, 8, &rme96->rev);
......
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