From fca013355efda3b23b5fd6f6e84ec272b32f454b Mon Sep 17 00:00:00 2001 From: Vignesh Kulothungan Date: Tue, 21 Apr 2020 11:35:36 -0700 Subject: [PATCH] ASoC: codecs: check component pointer before use Add NULL check for swr dmic component pointer before using it. CRs-Fixed: 2666974 Change-Id: I25c14c17f820ce3be7e1c7d892a2c0e29ac2b9fc Signed-off-by: Vignesh Kulothungan --- asoc/codecs/swr-dmic.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/asoc/codecs/swr-dmic.c b/asoc/codecs/swr-dmic.c index adeab5a942a5..20f0f4d60018 100644 --- a/asoc/codecs/swr-dmic.c +++ b/asoc/codecs/swr-dmic.c @@ -544,6 +544,11 @@ static int swr_dmic_probe(struct swr_device *pdev) component = snd_soc_lookup_component(&pdev->dev, swr_dmic->driver->name); + if (!component) { + dev_err(&pdev->dev, "%s: could not find swr_dmic component\n", + __func__); + goto dev_err; + } swr_dmic->component = component; prefix_name = devm_kzalloc(&pdev->dev, strlen(swr_dmic_name_prefix_of) + 1,