From c2757e5d4d374bcbf07be4266a587195cebe679d Mon Sep 17 00:00:00 2001 From: Vignesh Kulothungan Date: Mon, 27 Apr 2020 17:22:08 -0700 Subject: [PATCH] ASoC: add null check before use Add null check to validate pointer before use. CRs-Fixed: 2673395 Change-Id: Ief4785c8f6c9700204635df4d2efd35290d2690d Signed-off-by: Vignesh Kulothungan --- asoc/lahaina.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asoc/lahaina.c b/asoc/lahaina.c index 0ec6eaeeafe2..4074094de50a 100644 --- a/asoc/lahaina.c +++ b/asoc/lahaina.c @@ -6840,7 +6840,12 @@ static int msm_populate_dai_link_component_of_node( codecs_comp = devm_kzalloc(cdev, sizeof(struct snd_soc_dai_link_component) * codecs_enabled, GFP_KERNEL); - + if (!codecs_comp) { + dev_err(cdev, "%s: %s dailink codec component alloc failed\n", + __func__, dai_link[i].name); + ret = -ENOMEM; + goto err; + } index = 0; for (j = 0; j < dai_link[i].num_codecs; j++) { if(dai_link[i].codecs[j].of_node) {