Browse Source

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 <[email protected]>
Aditya Bavanari 6 years ago
parent
commit
5b2d30fa26
1 changed files with 20 additions and 16 deletions
  1. 20 16
      asoc/sm6150.c

+ 20 - 16
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);