[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191024124610.18182-1-colin.king@canonical.com>
Date: Thu, 24 Oct 2019 13:46:10 +0100
From: Colin King <colin.king@...onical.com>
To: Bard Liao <bardliao@...ltek.com>,
Oder Chiou <oder_chiou@...ltek.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Curtis Malainey <cujomalainey@...omium.org>,
Ben Zhang <benzh@...omium.org>, alsa-devel@...a-project.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] ASoC: rt5677: Add missing null check for failed allocation of rt5677_dsp
From: Colin Ian King <colin.king@...onical.com>
The allocation of rt5677_dsp can potentially fail and return null, so add
a null check and return -ENOMEM on a memory allocation failure.
Addresses-Coverity: ("Dereference null return")
Fixes: a0e0d135427c ("ASoC: rt5677: Add a PCM device for streaming hotword via SPI")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
sound/soc/codecs/rt5677-spi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c
index 36c02d200cfc..3a17643fcd9f 100644
--- a/sound/soc/codecs/rt5677-spi.c
+++ b/sound/soc/codecs/rt5677-spi.c
@@ -376,6 +376,8 @@ static int rt5677_spi_pcm_probe(struct snd_soc_component *component)
rt5677_dsp = devm_kzalloc(component->dev, sizeof(*rt5677_dsp),
GFP_KERNEL);
+ if (!rt5677_dsp)
+ return -ENOMEM;
rt5677_dsp->dev = &g_spi->dev;
mutex_init(&rt5677_dsp->dma_lock);
INIT_DELAYED_WORK(&rt5677_dsp->copy_work, rt5677_spi_copy_work);
--
2.20.1
Powered by blists - more mailing lists