summaryrefslogtreecommitdiff
path: root/sound/pci/echoaudio
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-15 06:58:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-27 10:33:56 +0300
commit574469ec6dcfc25c5ae8149fb93cb3dede55ba57 (patch)
tree91290d68e328249b5ba2ee5720caa70f5dcd1827 /sound/pci/echoaudio
parent0e9bb07a374ae378d45ce0c159504a3a2eb0fe72 (diff)
downloadlinux-574469ec6dcfc25c5ae8149fb93cb3dede55ba57.tar.xz
ALSA: echoaudio: add a check for ioremap_nocache
[ Upstream commit 6ade657d6125ec3ec07f95fa51e28138aef6208f ] In case ioremap_nocache fails, the fix releases chip and returns an error code upstream to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/pci/echoaudio')
-rw-r--r--sound/pci/echoaudio/echoaudio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 286f5e3686a3..d73ee11a32bd 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1953,6 +1953,11 @@ static int snd_echo_create(struct snd_card *card,
}
chip->dsp_registers = (volatile u32 __iomem *)
ioremap_nocache(chip->dsp_registers_phys, sz);
+ if (!chip->dsp_registers) {
+ dev_err(chip->card->dev, "ioremap failed\n");
+ snd_echo_free(chip);
+ return -ENOMEM;
+ }
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
KBUILD_MODNAME, chip)) {