diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-15 06:58:29 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-03-16 12:29:02 +0300 |
commit | 6ade657d6125ec3ec07f95fa51e28138aef6208f (patch) | |
tree | 563848112b08ad5b76c4f70b46cc3fe9af1ad936 /sound/pci/echoaudio | |
parent | da484d00f020af3dd7cfcc6c4b69a7f856832883 (diff) | |
download | linux-6ade657d6125ec3ec07f95fa51e28138aef6208f.tar.xz |
ALSA: echoaudio: add a check for ioremap_nocache
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>
Diffstat (limited to 'sound/pci/echoaudio')
-rw-r--r-- | sound/pci/echoaudio/echoaudio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index ea876b0b02b9..dc0084dc8550 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1952,6 +1952,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)) { |