aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/soc-core.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7093c1787128..65352c7d4b7f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3122,10 +3122,12 @@ int snd_soc_register_codec(struct device *dev,
3122 fixup_codec_formats(&dai_drv[i].capture); 3122 fixup_codec_formats(&dai_drv[i].capture);
3123 } 3123 }
3124 3124
3125 /* register DAIs */ 3125 /* register any DAIs */
3126 ret = snd_soc_register_dais(dev, dai_drv, num_dai); 3126 if (num_dai) {
3127 if (ret < 0) 3127 ret = snd_soc_register_dais(dev, dai_drv, num_dai);
3128 if (ret < 0)
3128 goto error; 3129 goto error;
3130 }
3129 3131
3130 mutex_lock(&client_mutex); 3132 mutex_lock(&client_mutex);
3131 list_add(&codec->list, &codec_list); 3133 list_add(&codec->list, &codec_list);
@@ -3164,8 +3166,9 @@ void snd_soc_unregister_codec(struct device *dev)
3164 return; 3166 return;
3165 3167
3166found: 3168found:
3167 for (i = 0; i < codec->num_dai; i++) 3169 if (codec->num_dai)
3168 snd_soc_unregister_dai(dev); 3170 for (i = 0; i < codec->num_dai; i++)
3171 snd_soc_unregister_dai(dev);
3169 3172
3170 mutex_lock(&client_mutex); 3173 mutex_lock(&client_mutex);
3171 list_del(&codec->list); 3174 list_del(&codec->list);