mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: samsung: idma: Check of ioremap return value
@ 2021-12-28  3:40 Jiasheng Jiang
  2021-12-28 13:12 ` Krzysztof Kozlowski
  2021-12-29 13:29 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2021-12-28  3:40 UTC (permalink / raw)
  To: krzysztof.kozlowski, s.nawrocki, lgirdwood, broonie, perex, tiwai
  Cc: alsa-devel, linux-kernel, Jiasheng Jiang

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>
---
 sound/soc/samsung/idma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index 66bcc2f97544..c3f1b054e238 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -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;
 }
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-29 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28  3:40 [PATCH] ASoC: samsung: idma: Check of ioremap return value Jiasheng Jiang
2021-12-28 13:12 ` Krzysztof Kozlowski
2021-12-29 13:29 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®