Skip to content

Commit 199b87f

Browse files
committed
ASoC: SOF: Correct sps->stream and cstream nullity
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>: The Nullity of sps->cstream needs to be checked in sof_ipc_msg_data() and not assume that it is not NULL. The sps->stream must be cleared to NULL on close since this is used as a check to see if we have active PCM stream.
2 parents b9cb90a + 46c7b90 commit 199b87f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

sound/soc/sof/pcm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ static int sof_pcm_close(struct snd_soc_component *component,
511511
*/
512512
}
513513

514+
spcm->stream[substream->stream].substream = NULL;
515+
514516
return 0;
515517
}
516518

sound/soc/sof/stream-ipc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,18 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
4343
return -ESTRPIPE;
4444

4545
posn_offset = stream->posn_offset;
46-
} else {
46+
} else if (sps->cstream) {
4747

4848
struct sof_compr_stream *sstream = sps->cstream->runtime->private_data;
4949

5050
if (!sstream)
5151
return -ESTRPIPE;
5252

5353
posn_offset = sstream->posn_offset;
54+
55+
} else {
56+
dev_err(sdev->dev, "%s: No stream opened\n", __func__);
57+
return -EINVAL;
5458
}
5559

5660
snd_sof_dsp_mailbox_read(sdev, posn_offset, p, sz);

0 commit comments

Comments
 (0)