From 5b2d30fa263046a00116145e55a48773edc5725d Mon Sep 17 00:00:00 2001 From: Aditya Bavanari Date: Mon, 28 Jan 2019 20:17:32 +0530 Subject: [PATCH] asoc: sm6150: Correct codec_root entry creation logic Create codec root entry only if it is not created already in proc directory to avoid failures in codec version entry enumeration. Change-Id: I8c912be5fb0f229a3b5a088ebb5c0aeea06f67b2 Signed-off-by: Aditya Bavanari --- asoc/sm6150.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/asoc/sm6150.c b/asoc/sm6150.c index 4e084e312f25..96533faa9528 100644 --- a/asoc/sm6150.c +++ b/asoc/sm6150.c @@ -4912,15 +4912,17 @@ static int msm_audrx_tavil_init(struct snd_soc_pcm_runtime *rtd) } card = rtd->card->snd_card; - entry = snd_info_create_subdir(card->module, "codecs", - card->proc_root); - if (!entry) { - pr_debug("%s: Cannot create codecs module entry\n", - __func__); - ret = 0; - goto err; + if (!pdata->codec_root) { + entry = snd_info_create_subdir(card->module, "codecs", + card->proc_root); + if (!entry) { + pr_debug("%s: Cannot create codecs module entry\n", + __func__); + ret = 0; + goto err; + } + pdata->codec_root = entry; } - pdata->codec_root = entry; tavil_codec_info_create_codec_entry(pdata->codec_root, component); codec_reg_done = true; @@ -5088,15 +5090,17 @@ static int msm_audrx_tasha_init(struct snd_soc_pcm_runtime *rtd) } card = rtd->card->snd_card; - entry = snd_info_create_subdir(card->module, "codecs", - card->proc_root); - if (!entry) { - pr_debug("%s: Cannot create codecs module entry\n", - __func__); - ret = 0; - goto err; + if (!pdata->codec_root) { + entry = snd_info_create_subdir(card->module, "codecs", + card->proc_root); + if (!entry) { + pr_debug("%s: Cannot create codecs module entry\n", + __func__); + ret = 0; + goto err; + } + pdata->codec_root = entry; } - pdata->codec_root = entry; tasha_codec_info_create_codec_entry(pdata->codec_root, component); tasha_mbhc_zdet_gpio_ctrl(msm_config_hph_en0_gpio, component);