From: Kangjie Lu Date: Fri, 15 Mar 2019 03:58:29 +0000 (-0500) Subject: ALSA: echoaudio: add a check for ioremap_nocache X-Git-Tag: v5.15~6526^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ade657d6125ec3ec07f95fa51e28138aef6208f;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index ea876b0..dc0084d 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)) {