Skip to content

Commit

Permalink
ALSA: intel8x0m: Register irq handler after register initializations
Browse files Browse the repository at this point in the history
The interrupt handler has to be acquired after the other resource
initialization when allocated with IRQF_SHARED.  Otherwise it's
triggered before the resource gets ready, and may lead to unpleasant
behavior.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Sep 13, 2018
1 parent 5b03006 commit 7064f37
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions sound/pci/intel8x0m.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,16 +1171,6 @@ static int snd_intel8x0m_create(struct snd_card *card,
}

port_inited:
if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_intel8x0m_free(chip);
return -EBUSY;
}
chip->irq = pci->irq;
pci_set_master(pci);
synchronize_irq(chip->irq);

/* initialize offsets */
chip->bdbars_count = 2;
tbl = intel_regs;
Expand Down Expand Up @@ -1224,11 +1214,21 @@ static int snd_intel8x0m_create(struct snd_card *card,
chip->int_sta_reg = ICH_REG_GLOB_STA;
chip->int_sta_mask = int_sta_masks;

pci_set_master(pci);

if ((err = snd_intel8x0m_chip_init(chip, 1)) < 0) {
snd_intel8x0m_free(chip);
return err;
}

if (request_irq(pci->irq, snd_intel8x0m_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {
dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_intel8x0m_free(chip);
return -EBUSY;
}
chip->irq = pci->irq;

if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
snd_intel8x0m_free(chip);
return err;
Expand Down

0 comments on commit 7064f37

Please sign in to comment.