Commit b63d4d13 authored by Oder Chiou's avatar Oder Chiou Committed by Mark Brown

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'.
Signed-off-by: default avatarOder Chiou <oder_chiou@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6eebf35b
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment