Skip to contentSkip to conversation

ASoC: SOF: ipc4-topology: Fix a less than zero check on a u32

PATCH In review Colin Ian King 3 participants 3 messages Sep 2, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: SOF: ipc4-topology: Fix a less than zero check on a u32

Currently the error check from the call to sof_ipc4_get_sample_type is always false because a u32 variable out_ref_type is being used to perform the less than zero check. Fix this by using the int variable ret to perform the check.

Fixes c04c2e829649 ("ASoC: SOF: ipc4-topology: Add support for 8-bit formats")
---
 sound/soc/sof/ipc4-topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/ipc4-topology.c +4 -3
index f5e62cd8fc0c..b6a732d0adb4 100644
@@ -2191,9 +2191,10 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 	case snd_soc_dapm_dai_in:
 		out_ref_rate = params_rate(fe_params);
 		out_ref_channels = params_channels(fe_params);
-		out_ref_type = sof_ipc4_get_sample_type(sdev, fe_params);
-		if (out_ref_type < 0)
-			return out_ref_type;
+		ret = sof_ipc4_get_sample_type(sdev, fe_params);
+		if (ret < 0)
+			return ret;
+		out_ref_type = (u32)ret;
 
 		if (!single_output_bitdepth) {
 			out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params);
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Colin Ian King

Currently the error check from the call to sof_ipc4_get_sample_type is always false because a u32 variable out_ref_type is being used to perform the less than zero check. Fix this by using the int variable ret to perform the check.

Fixes c04c2e829649 ("ASoC: SOF: ipc4-topology: Add support for 8-bit formats")
Quoted 22 lines
---
 sound/soc/sof/ipc4-topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sof/ipc4-topology.c +4 -3
index f5e62cd8fc0c..b6a732d0adb4 100644
@@ -2191,9 +2191,10 @@ sof_ipc4_prepare_copier_module(struct snd_sof_widget *swidget,
 	case snd_soc_dapm_dai_in:
 		out_ref_rate = params_rate(fe_params);
 		out_ref_channels = params_channels(fe_params);
-		out_ref_type = sof_ipc4_get_sample_type(sdev, fe_params);
-		if (out_ref_type < 0)
-			return out_ref_type;
+		ret = sof_ipc4_get_sample_type(sdev, fe_params);
+		if (ret < 0)
+			return ret;
+		out_ref_type = (u32)ret;
 
 		if (!single_output_bitdepth) {
 			out_ref_valid_bits = sof_ipc4_get_valid_bits(sdev, fe_params);
Signature · 1 line
Péter
maintainer
#2 lore raw
In reply to Colin Ian King
Quoted 6 lines · Colin Ian King

Currently the error check from the call to sof_ipc4_get_sample_type is always false because a u32 variable out_ref_type is being used to perform the less than zero check. Fix this by using the int variable ret to perform the check.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-topology: Fix a less than zero check on a u32

      commit: 3279052eab235bfb7130b1fabc74029c2260ed8d

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark