From a9aa872509f48fe791a7df274eeb054df81192d6 Mon Sep 17 00:00:00 2001 From: Vidyakumar Athota Date: Mon, 8 Aug 2016 20:42:54 -0700 Subject: [PATCH] ASoC: msmcobalt: fix wrong platform device pointer assignment In machine driver probe, platform device pointer is assigned prior to codec registration which might be invalid if wcd9335 and wcd934x sound card registrations are going on simultaneously. Update the pointer after sound card registration to avoid null pointer dereference. CRs-Fixed: 1048402 Change-Id: I315e191227e14e207187673b8efb5401143dec9d Signed-off-by: Vidyakumar Athota --- sound/soc/msm/msmcobalt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/soc/msm/msmcobalt.c b/sound/soc/msm/msmcobalt.c index 945250babf2d..fc22d1248308 100644 --- a/sound/soc/msm/msmcobalt.c +++ b/sound/soc/msm/msmcobalt.c @@ -3950,8 +3950,6 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) goto err; } - spdev = pdev; - ret = msm_populate_dai_link_component_of_node(card); if (ret) { ret = -EPROBE_DEFER; @@ -3989,6 +3987,7 @@ static int msm_asoc_machine_probe(struct platform_device *pdev) goto err; } dev_info(&pdev->dev, "Sound card %s registered\n", card->name); + spdev = pdev; ret = of_property_read_string(pdev->dev.of_node, "qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type);