ALSA: intel8x0: Fix missing check in snd_intel8x0m_create

When device_type == DEVICE_ALI, we should also check the return
value of pci_iomap() to avoid potential null pointer dereference.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20210131100916.7915-1-dinghao.liu@zju.edu.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Dinghao Liu 2021-01-31 18:09:14 +08:00 committed by Takashi Iwai
parent 0417fadab4
commit 0074946932
1 changed files with 2 additions and 1 deletions

View File

@ -1129,13 +1129,14 @@ static int snd_intel8x0m_create(struct snd_card *card,
chip->bmaddr = pci_iomap(pci, 3, 0);
else
chip->bmaddr = pci_iomap(pci, 1, 0);
port_inited:
if (!chip->bmaddr) {
dev_err(card->dev, "Controller space ioremap problem\n");
snd_intel8x0m_free(chip);
return -EIO;
}
port_inited:
/* initialize offsets */
chip->bdbars_count = 2;
tbl = intel_regs;