[alsa-devel] [PATCH 1/2] ASoC: rt5514: Fix the issue that the variable dereferenced before checking
Oder Chiou
oder_chiou at realtek.com
Fri Jun 17 05:02:23 CEST 2016
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'.
Signed-off-by: Oder Chiou <oder_chiou at realtek.com>
---
sound/soc/codecs/rt5514-spi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 8a9382e..743f509 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)
--
1.8.1.1.439.g50a6b54
More information about the Alsa-devel
mailing list