diff options
author | Oder Chiou <oder_chiou@realtek.com> | 2016-06-17 11:02:23 +0800 |
---|---|---|
committer | Ilkka Koskinen <ilkka.koskinen@intel.com> | 2016-09-29 14:54:52 -0700 |
commit | 8faca1411954479071c40fb41b47d977568a7d21 (patch) | |
tree | 3b6b8d316c438396b31882e530088ea20dffbd80 | |
parent | daffa3141dba5ed3096d09d159a6592e5249389a (diff) | |
download | broxton-v4.4-8faca1411954479071c40fb41b47d977568a7d21.tar.gz |
UPSTREAM: ASoC: rt5514: Fix the issue that the variable dereferenced before checking
The patch fixes the issue that variable dereferenced before checking
'rt5514_dsp->substream'. Move the assignment to after the variable
checking of 'rt5514_dsp->substream'.
BUG=chrome-os-partner:52172
TEST=rt5514 spi codec can be loaded
Change-Id: I8f6da337577ab3f1f615295a657fca89684e258c
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git topic/rt5614
commit b63d4d13ac7b8f947407a7eb44fdc40fadc8c5b8)
Reviewed-on: https://chromium-review.googlesource.com/358503
-rw-r--r-- | sound/soc/codecs/rt5514-spi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 8a9382e9787a..743f509d48b7 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -80,7 +80,7 @@ static void rt5514_spi_copy_work(struct work_struct *work) { struct rt5514_dsp *rt5514_dsp = container_of(work, struct rt5514_dsp, copy_work.work); - struct snd_pcm_runtime *runtime = rt5514_dsp->substream->runtime; + struct snd_pcm_runtime *runtime; size_t period_bytes, truncated_bytes = 0; mutex_lock(&rt5514_dsp->dma_lock); @@ -89,6 +89,7 @@ static void rt5514_spi_copy_work(struct work_struct *work) goto done; } + runtime = rt5514_dsp->substream->runtime; period_bytes = snd_pcm_lib_period_bytes(rt5514_dsp->substream); if (rt5514_dsp->buf_size - rt5514_dsp->dsp_offset < period_bytes) |