MLK-10048-1: ASoC: fsl_asrc: add protection the old version asrc
authorShengjiu Wang <shengjiu.wang@freescale.com>
Mon, 8 Dec 2014 05:03:17 +0000 (13:03 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:11 +0000 (14:48 -0500)
The latest asrc's channel bits is 4, bit the old asrc's channel bits is 3.
So here add protection for when using the old version asrc.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit e282d8825217c6f4ece4f9dcc2efa3421ea22b4b)

sound/soc/fsl/fsl_asrc.c

index 98bc5d4..6113b84 100644 (file)
@@ -113,7 +113,8 @@ static int fsl_asrc_request_pair(int channels, struct fsl_asrc_pair *pair)
        if (index == ASRC_INVALID_PAIR) {
                dev_err(dev, "all pairs are busy now\n");
                ret = -EBUSY;
-       } else if (asrc_priv->channel_avail < channels) {
+       } else if (asrc_priv->channel_avail < channels ||
+               (asrc_priv->channel_bits < 4 && channels % 2 != 0)) {
                dev_err(dev, "can't afford required channels: %d\n", channels);
                ret = -EINVAL;
        } else {