[alsa-devel] [PATCH 2/2] ASoC: simple-card: test memory allocation

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Sat Mar 9 03:02:52 CET 2019


devm_kcalloc() return value needs to be tested

Fixes: 17029e494edc6 ('ASoC: simple-card: add link_info')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
 sound/soc/generic/simple-card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 08df261024cf..bed4fe5721a2 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -715,7 +715,7 @@ static int simple_probe(struct platform_device *pdev)
 	dai_link  = devm_kcalloc(dev, li.link, sizeof(*dai_link),  GFP_KERNEL);
 	dais      = devm_kcalloc(dev, li.dais, sizeof(*dais),      GFP_KERNEL);
 	cconf     = devm_kcalloc(dev, li.conf, sizeof(*cconf),     GFP_KERNEL);
-	if (!dai_props || !dai_link || !dais)
+	if (!dai_props || !dai_link || !dais || !cconf)
 		return -ENOMEM;
 
 	/*
-- 
2.17.1



More information about the Alsa-devel mailing list