]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: pcm: Reverse check for prepared stream in sof_pcm_hw_params()
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Thu, 19 Jun 2025 10:45:51 +0000 (13:45 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 19 Jun 2025 23:21:16 +0000 (00:21 +0100)
Reduce the number of checks needed with the simple and most common audio
sequence when the stream is started then stopped.

If the stream has not been prepared there is no need to check if we have
pcm_ops and pcm_ops->hw_free() callback as it does not matter.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://patch.msgid.link/20250619104551.25912-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/pcm.c

index acf1995e04e8fe262f9aa12b3168b401a69e9038..090ea3a76892a09fdf5ac5bc85ca36ce13f8c373 100644 (file)
@@ -126,7 +126,7 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
         * Handle repeated calls to hw_params() without free_pcm() in
         * between. At least ALSA OSS emulation depends on this.
         */
-       if (pcm_ops && pcm_ops->hw_free && spcm->prepared[substream->stream]) {
+       if (spcm->prepared[substream->stream] && pcm_ops && pcm_ops->hw_free) {
                ret = pcm_ops->hw_free(component, substream);
                if (ret < 0)
                        return ret;