Skip to content

Commit b63d4d1

Browse files
oder-chioubroonie
authored andcommitted
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: Oder Chiou <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 6eebf35 commit b63d4d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sound/soc/codecs/rt5514-spi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static void rt5514_spi_copy_work(struct work_struct *work)
8080
{
8181
struct rt5514_dsp *rt5514_dsp =
8282
container_of(work, struct rt5514_dsp, copy_work.work);
83-
struct snd_pcm_runtime *runtime = rt5514_dsp->substream->runtime;
83+
struct snd_pcm_runtime *runtime;
8484
size_t period_bytes, truncated_bytes = 0;
8585

8686
mutex_lock(&rt5514_dsp->dma_lock);
@@ -89,6 +89,7 @@ static void rt5514_spi_copy_work(struct work_struct *work)
8989
goto done;
9090
}
9191

92+
runtime = rt5514_dsp->substream->runtime;
9293
period_bytes = snd_pcm_lib_period_bytes(rt5514_dsp->substream);
9394

9495
if (rt5514_dsp->buf_size - rt5514_dsp->dsp_offset < period_bytes)

0 commit comments

Comments
 (0)