Skip to content

Commit

Permalink
ASoC: rt5514: Fix the issue that the variable dereferenced before che…
Browse files Browse the repository at this point in the history
…cking

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@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Oder Chiou authored and Mark Brown committed Jun 22, 2016
1 parent 6eebf35 commit b63d4d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sound/soc/codecs/rt5514-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit b63d4d1

Please sign in to comment.