diff mbox series

[2/8] ASoC: SOF: ipc4-topology: Use local variables in sof_ipc4_init_input_audio_fmt()

Message ID 20241008110936.22534-3-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit 3b54c1cd69d04bbdafc5542d11c6cab685fc13bd
Headers show
Series ASoC: SOF: ipc4-topology: Rework the module audio format prints | expand

Commit Message

Peter Ujfalusi Oct. 8, 2024, 11:09 a.m. UTC
We have local copies of available_fmt->input_pin_fmts and
available_fmt->num_input_formats, use them in the function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
 sound/soc/sof/ipc4-topology.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c
index 7967ec4c406a..af5eea853745 100644
--- a/sound/soc/sof/ipc4-topology.c
+++ b/sound/soc/sof/ipc4-topology.c
@@ -1278,13 +1278,12 @@  static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
 	int sample_valid_bits;
 	int i = 0;
 
-	if (!available_fmt->num_input_formats) {
+	if (!pin_fmts_size) {
 		dev_err(sdev->dev, "no input formats for %s\n", swidget->widget->name);
 		return -EINVAL;
 	}
 
-	single_format = sof_ipc4_is_single_format(sdev, available_fmt->input_pin_fmts,
-						  available_fmt->num_input_formats);
+	single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
 	if (single_format)
 		goto in_fmt;
 
@@ -1321,15 +1320,15 @@  static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
 
 in_fmt:
 	/* copy input format */
-	if (available_fmt->num_input_formats && i < available_fmt->num_input_formats) {
-		memcpy(&base_config->audio_fmt, &available_fmt->input_pin_fmts[i].audio_fmt,
+	if (pin_fmts_size && i < pin_fmts_size) {
+		memcpy(&base_config->audio_fmt, &pin_fmts[i].audio_fmt,
 		       sizeof(struct sof_ipc4_audio_format));
 
 		/* set base_cfg ibs/obs */
-		base_config->ibs = available_fmt->input_pin_fmts[i].buffer_size;
+		base_config->ibs = pin_fmts[i].buffer_size;
 
 		dev_dbg(sdev->dev, "Init input audio formats for %s\n", swidget->widget->name);
-		sof_ipc4_dbg_audio_format(sdev->dev, &available_fmt->input_pin_fmts[i], 1);
+		sof_ipc4_dbg_audio_format(sdev->dev, &pin_fmts[i], 1);
 	}
 
 	return i;