Skip to content

Commit

Permalink
ASoC: SOF: Correct sps->stream and cstream nullity
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark Brown committed Feb 6, 2025
2 parents b9cb90a + 46c7b90 commit 199b87f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sound/soc/sof/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ static int sof_pcm_close(struct snd_soc_component *component,
*/
}

spcm->stream[substream->stream].substream = NULL;

return 0;
}

Expand Down
6 changes: 5 additions & 1 deletion sound/soc/sof/stream-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,18 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
return -ESTRPIPE;

posn_offset = stream->posn_offset;
} else {
} else if (sps->cstream) {

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

if (!sstream)
return -ESTRPIPE;

posn_offset = sstream->posn_offset;

} else {
dev_err(sdev->dev, "%s: No stream opened\n", __func__);
return -EINVAL;
}

snd_sof_dsp_mailbox_read(sdev, posn_offset, p, sz);
Expand Down

0 comments on commit 199b87f

Please sign in to comment.