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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 08:00:53 +0000 (09:00 +0100)
[ Upstream commit 3ecb46755eb85456b459a1a9f952c52986bce8ec ]

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: f09aecd50f39 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/samsung/idma.c

index a635df61f928c7f1164206754a937fa79010dc60..2a6ffb2abb33879d9be67edafede29712137a556 100644 (file)
@@ -369,6 +369,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;
 }