aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorNicolin Chen <nicoleotsuka@gmail.com>2014-08-04 00:19:48 -0400
committerMark Brown <broonie@linaro.org>2014-08-04 10:48:41 -0400
commit6ccf62c7bea561cca7ffbd50839f883327080800 (patch)
treeefbedd0abf754e92a07a5c663d5c5bd7d2d571f7 /sound/soc/fsl
parentd387dd08e444b22f844475780fe12a1ad1c6fffd (diff)
ASoC: fsl_sarc_dma: Check pair before using it
The patch 3117bb3109dc: "ASoC: fsl_asrc: Add ASRC ASoC CPU DAI and platform drivers" from Jul 29, 2014, leads to the following Smatch complaint: sound/soc/fsl/fsl_asrc_dma.c:304 fsl_asrc_dma_shutdown() warn: variable dereferenced before check 'pair' (see line 302) sound/soc/fsl/fsl_asrc_dma.c 301 struct fsl_asrc_pair *pair = runtime->private_data; 302 struct fsl_asrc *asrc_priv = pair->asrc_priv; ^^^^^^^^^^^^^^^ Dereference. 303 304 if (pair && asrc_priv->pair[pair->index] == pair) ^^^^ Check. 305 asrc_priv->pair[pair->index] = NULL; 306 So we just let the driver check pair before using it. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_asrc_dma.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index 5b1e73e97817..ffc000bc1f15 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -299,9 +299,14 @@ static int fsl_asrc_dma_shutdown(struct snd_pcm_substream *substream)
299{ 299{
300 struct snd_pcm_runtime *runtime = substream->runtime; 300 struct snd_pcm_runtime *runtime = substream->runtime;
301 struct fsl_asrc_pair *pair = runtime->private_data; 301 struct fsl_asrc_pair *pair = runtime->private_data;
302 struct fsl_asrc *asrc_priv = pair->asrc_priv; 302 struct fsl_asrc *asrc_priv;
303
304 if (!pair)
305 return 0;
306
307 asrc_priv = pair->asrc_priv;
303 308
304 if (pair && asrc_priv->pair[pair->index] == pair) 309 if (asrc_priv->pair[pair->index] == pair)
305 asrc_priv->pair[pair->index] = NULL; 310 asrc_priv->pair[pair->index] = NULL;
306 311
307 kfree(pair); 312 kfree(pair);