ASoC: Error out if we can't determine a suitable WM9081 sysclk
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 15 Jul 2009 09:36:51 +0000 (10:36 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 15 Jul 2009 10:03:51 +0000 (11:03 +0100)
Due to the flexibility of the WM9081 FLL this should never happen
in a real system.

Reported-by: Jaswinder Singh Rajput <jaswinder@kernel.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm9081.c

index dbe20597d872e1992a65431b42af3361419cc1f1..156f2a4a593096f44ad21d3940991b5a542e3690 100644 (file)
@@ -707,6 +707,10 @@ static int configure_clock(struct snd_soc_codec *codec)
                                    target > 3000000)
                                        break;
                        }
+
+                       if (i == ARRAY_SIZE(clk_sys_rates))
+                               return -EINVAL;
+
                } else if (wm9081->fs) {
                        for (i = 0; i < ARRAY_SIZE(clk_sys_rates); i++) {
                                new_sysclk = clk_sys_rates[i].ratio
@@ -714,6 +718,10 @@ static int configure_clock(struct snd_soc_codec *codec)
                                if (new_sysclk > 3000000)
                                        break;
                        }
+
+                       if (i == ARRAY_SIZE(clk_sys_rates))
+                               return -EINVAL;
+
                } else {
                        new_sysclk = 12288000;
                }