]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ASoC: samsung: idma: Check of ioremap return value
authorJiasheng Jiang <jiasheng@iscas.ac.cn>
Tue, 28 Dec 2021 03:40:26 +0000 (11:40 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 29 Dec 2021 12:45:46 +0000 (12:45 +0000)
Because of the potential failure of the ioremap(), the buf->area could
be NULL.
Therefore, we need to check it and return -ENOMEM in order to transfer
the error.

Fixes: 65a314121ee2 ("ASoC: SAMSUNG: Add I2S0 internal dma driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20211228034026.1659385-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/samsung/idma.c

index 66bcc2f97544bfecf0f905c363a85c37fe3a34a1..c3f1b054e2389c5e233258541d614d759c20a795 100644 (file)
@@ -360,6 +360,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream)
        buf->addr = idma.lp_tx_addr;
        buf->bytes = idma_hardware.buffer_bytes_max;
        buf->area = (unsigned char * __force)ioremap(buf->addr, buf->bytes);
+       if (!buf->area)
+               return -ENOMEM;
 
        return 0;
 }