]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ASoC: fsl_sarc_dma: Check pair before using it
authorNicolin Chen <nicoleotsuka@gmail.com>
Mon, 4 Aug 2014 04:19:48 +0000 (12:19 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Fri, 16 Jan 2015 03:17:02 +0000 (21:17 -0600)
commit59aefcae9756c1f01ce3040f78bc2e3089ed7381
treee18642836c8c45a8d4ecbb8d20acc9afaf3e02c8
parenta6d95567aa5ceb660c364a677d39ea8602a7d31b
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>
(cherry picked from commit 6ccf62c7bea561cca7ffbd50839f883327080800)
sound/soc/fsl/fsl_asrc_dma.c