ASoC: wcd934x: Initialize mbhc pointer before access

Initialize mbhc pointer before it gets accessed from
a different thread.

Change-Id: Ie1a5038458b0b93dfec3e5bfc350686eb1f8eb1b
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
This commit is contained in:
Phani Kumar Uppalapati 2016-10-25 18:50:54 -07:00
parent 30b895d9f1
commit 1fcf0af78a

View file

@ -1015,6 +1015,7 @@ int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec,
0;
}
(*mbhc) = wcd934x_mbhc;
snd_soc_add_codec_controls(codec, impedance_detect_controls,
ARRAY_SIZE(impedance_detect_controls));
snd_soc_add_codec_controls(codec, hph_type_detect_controls,
@ -1023,8 +1024,6 @@ int tavil_mbhc_init(struct wcd934x_mbhc **mbhc, struct snd_soc_codec *codec,
snd_soc_update_bits(codec, WCD934X_MBHC_NEW_CTL_1, 0x04, 0x04);
snd_soc_update_bits(codec, WCD934X_MBHC_CTL_BCS, 0x01, 0x01);
(*mbhc) = wcd934x_mbhc;
return 0;
err:
devm_kfree(codec->dev, wcd934x_mbhc);