[alsa-devel] [PATCH 5/5] ASoC: DAPM: Return -ENOMEM in snd_soc_dapm_new_dai_widgets()

Takashi Iwai tiwai at suse.de
Mon Oct 28 14:21:50 CET 2013


... instead of NULL dereferences.

Spotted by coverity CID 402004.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/soc/soc-dapm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8ab2b35..458c672 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3528,6 +3528,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
 		if (!w) {
 			dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
 				dai->driver->playback.stream_name);
+			return -ENOMEM;
 		}
 
 		w->priv = dai;
@@ -3546,6 +3547,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
 		if (!w) {
 			dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
 				dai->driver->capture.stream_name);
+			return -ENOMEM;
 		}
 
 		w->priv = dai;
-- 
1.8.4.1



More information about the Alsa-devel mailing list