Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions sound/soc/sof/ipc4-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
u32 channels;
u32 rate;
u32 type;
bool single_format;
int sample_valid_bits;
int sample_type;
int i = 0;
Expand All @@ -1576,10 +1575,6 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
return -EINVAL;
}

single_format = sof_ipc4_is_single_format(sdev, pin_fmts, pin_fmts_size);
if (single_format)
goto in_fmt;

sample_valid_bits = sof_ipc4_get_valid_bits(sdev, params);
if (sample_valid_bits < 0)
return sample_valid_bits;
Expand All @@ -1604,16 +1599,15 @@ static int sof_ipc4_init_input_audio_fmt(struct snd_sof_dev *sdev,
type = sof_ipc4_fmt_cfg_to_type(fmt->fmt_cfg);
if (params_rate(params) == rate && params_channels(params) == channels &&
sample_valid_bits == valid_bits && sample_type == type)
break;
goto in_fmt;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stylistically I think the commonly used pattern, where goto is only used for error handling is clearer. IIUC this change is using goto to jump to a success case continuation, while handling the error on the main code path. Also it doesn't seem to be related to the fix. The actual fix seems to be removing the lines 1579-1582 (and removing the jump label), that would also make the patch smaller

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the code - including the return statement - after in_fmt: label could be added here in side this if statement, and the loop would still be reasonable size. But IMO not a big deal.

Copy link
Collaborator Author

@ujfalusi ujfalusi Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, I converted this function to work and look like the coutnerpart sof_ipc4_init_output_audio_fmt().

I can keep the two function different, but I cannot change the output function when touching the input.

}

if (i == pin_fmts_size) {
dev_err(sdev->dev,
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
__func__, params_rate(params), sample_valid_bits,
params_channels(params), sample_type);
return -EINVAL;
}
dev_err(sdev->dev,
"%s: Unsupported audio format: %uHz, %ubit, %u channels, type: %d\n",
__func__, params_rate(params), sample_valid_bits,
params_channels(params), sample_type);

return -EINVAL;

in_fmt:
/* copy input format */
Expand Down
Loading