]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: simple-card: fix __asoc_simple_card_dai_init
authorXiubo Li <Li.Xiubo@freescale.com>
Fri, 24 Jan 2014 07:43:00 +0000 (15:43 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 3 Feb 2014 12:45:34 +0000 (12:45 +0000)
If the CPU/CODEC DAI set_sysclk() is not support, the -ENOTSUPP will returnd.
Here do the check like set_fmt().

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/generic/simple-card.c

index 6443c87e8625e764c1597aa819eb4edc5a18e0d5..6366f3fa6a37c2795071ed5696919f43decaa56e 100644 (file)
@@ -27,21 +27,29 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
                                       struct asoc_simple_dai *set,
                                       unsigned int daifmt)
 {
-       int ret = 0;
+       int ret;
 
        daifmt |= set->fmt;
 
-       if (daifmt)
+       if (daifmt) {
                ret = snd_soc_dai_set_fmt(dai, daifmt);
-
-       if (ret == -ENOTSUPP) {
-               dev_dbg(dai->dev, "ASoC: set_fmt is not supported\n");
-               ret = 0;
+               if (ret && ret != -ENOTSUPP) {
+                       dev_err(dai->dev, "simple-card: set_fmt error\n");
+                       goto err;
+               }
        }
 
-       if (!ret && set->sysclk)
+       if (set->sysclk) {
                ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
+               if (ret && ret != -ENOTSUPP) {
+                       dev_err(dai->dev, "simple-card: set_sysclk error\n");
+                       goto err;
+               }
+       }
+
+       ret = 0;
 
+err:
        return ret;
 }