summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorShailendra Verma <shailendra.v@samsung.com>2017-01-27 06:10:57 -0500
committerMark Brown <broonie@kernel.org>2017-01-27 06:58:54 -0500
commit3f81d9aa80ae4b513416440e416a6486ef2ad817 (patch)
tree5757171f3fcac3c89859764354ac93945f258e64 /sound
parenta5de5b74a50113564a1e0850e2da96c37c35e55d (diff)
ASoC: davinci - Fix possible NULL derefrence.
of_match_device could return NULL, and so can cause a NULL pointer dereference later. Signed-off-by: Shailendra Verma <shailendra.v@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/davinci/davinci-evm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 731fb0d86c6a..7a369e0f2093 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -358,13 +358,20 @@ static struct snd_soc_card evm_soc_card = {
358static int davinci_evm_probe(struct platform_device *pdev) 358static int davinci_evm_probe(struct platform_device *pdev)
359{ 359{
360 struct device_node *np = pdev->dev.of_node; 360 struct device_node *np = pdev->dev.of_node;
361 const struct of_device_id *match = 361 const struct of_device_id *match;
362 of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); 362 struct snd_soc_dai_link *dai;
363 struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data;
364 struct snd_soc_card_drvdata_davinci *drvdata = NULL; 363 struct snd_soc_card_drvdata_davinci *drvdata = NULL;
365 struct clk *mclk; 364 struct clk *mclk;
366 int ret = 0; 365 int ret = 0;
367 366
367 match = of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
368 if (!match) {
369 dev_err(&pdev->dev, "Error: No device match found\n");
370 return -ENODEV;
371 }
372
373 dai = (struct snd_soc_dai_link *) match->data;
374
368 evm_soc_card.dai_link = dai; 375 evm_soc_card.dai_link = dai;
369 376
370 dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0); 377 dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);