ASoC: compress: Prevent multicodec for compressed stream
authorBenoit Cousson <bcousson@baylibre.com>
Tue, 8 Jul 2014 21:19:37 +0000 (23:19 +0200)
committerMark Brown <broonie@linaro.org>
Wed, 16 Jul 2014 22:06:27 +0000 (23:06 +0100)
Multiple codecs does not make sense in the case of compressed
stream.

Exit with error if it happens.

Signed-off-by: Benoit Cousson <bcousson@baylibre.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-compress.c

index f96fb96b2678aaf6afb05e17e42a8430ca4e839d..27c06acce205c0887a3663cc0854b851eddefcf3 100644 (file)
@@ -629,6 +629,11 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
        char new_name[64];
        int ret = 0, direction = 0;
 
+       if (rtd->num_codecs > 1) {
+               dev_err(rtd->card->dev, "Multicodec not supported for compressed stream\n");
+               return -EINVAL;
+       }
+
        /* check client and interface hw capabilities */
        snprintf(new_name, sizeof(new_name), "%s %s-%d",
                        rtd->dai_link->stream_name, codec_dai->name, num);