MLK-11915-11 ASoC: fsl_asrc_dma: check the return value for snd_pcm_hw_constraint_int...
authorZidan Wang <zidan.wang@freescale.com>
Fri, 27 Nov 2015 05:45:09 +0000 (13:45 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:19 +0000 (14:49 -0500)
check the return value for snd_pcm_hw_constraint_integer().
Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit 26f8fea617fcebd8835f660534a988c58b9f0517)

sound/soc/fsl/fsl_asrc_dma.c

index c19f53c..69a714e 100644 (file)
@@ -293,6 +293,7 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream)
        struct device *dev = rtd->platform->dev;
        struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
        struct fsl_asrc_pair *pair;
+       int ret;
 
        pair = kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL);
        if (!pair) {
@@ -304,8 +305,12 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream)
 
        runtime->private_data = pair;
 
-       snd_pcm_hw_constraint_integer(substream->runtime,
-                                     SNDRV_PCM_HW_PARAM_PERIODS);
+       ret = snd_pcm_hw_constraint_integer(substream->runtime,
+                       SNDRV_PCM_HW_PARAM_PERIODS);
+       if (ret < 0) {
+               dev_err(dev, "failed to set pcm hw params periods\n");
+               return ret;
+       }
        snd_soc_set_runtime_hwparams(substream, &snd_imx_hardware);
 
        return 0;