ALSA: lx6464es: add error handling for pci_ioremap_bar

When pci_ioremap_bar fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling pci_ioremap_bar.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Zhouyang Jia 2018-06-14 21:51:46 +08:00 committed by Takashi Iwai
parent 41538f2db1
commit 4a23fc8cc0
1 changed files with 7 additions and 0 deletions

View File

@ -1016,6 +1016,10 @@ static int snd_lx6464es_create(struct snd_card *card,
/* dsp port */ /* dsp port */
chip->port_dsp_bar = pci_ioremap_bar(pci, 2); chip->port_dsp_bar = pci_ioremap_bar(pci, 2);
if (!chip->port_dsp_bar) {
dev_err(card->dev, "cannot remap PCI memory region\n");
goto remap_pci_failed;
}
err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq, err = request_threaded_irq(pci->irq, lx_interrupt, lx_threaded_irq,
IRQF_SHARED, KBUILD_MODNAME, chip); IRQF_SHARED, KBUILD_MODNAME, chip);
@ -1055,6 +1059,9 @@ device_new_failed:
free_irq(pci->irq, chip); free_irq(pci->irq, chip);
request_irq_failed: request_irq_failed:
iounmap(chip->port_dsp_bar);
remap_pci_failed:
pci_release_regions(pci); pci_release_regions(pci);
request_regions_failed: request_regions_failed: