Skip to contentSkip to conversation

ASoC: SOF: ipc4-topology: Free the ida when IPC fails in sof_ipc4_widget_setup()

PATCH In review Peter Ujfalusi 2 participants 2 messages Sep 21, 2022

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

PATCH 1/1 ASoC: SOF: ipc4-topology: Free the ida when IPC fails in sof_ipc4_widget_setup()

The allocated ida needs to be freed up if the IPC message fails since next time when we try again to set up the widget we are going to try to allocate another ID and given enough tries, we are going to run out of unique IDs.

Fixes 711d0427c713 ("ASoC: SOF: ipc4-topology: move ida allocate/free to widget_setup/free")
---
 sound/soc/sof/ipc4-topology.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
sound/soc/sof/ipc4-topology.c +8 -1
index 64929dc9af39..340d92452d7c 100644
@@ -1544,9 +1544,16 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
 	msg->data_ptr = ipc_data;
 
 	ret = sof_ipc_tx_message(sdev->ipc, msg, ipc_size, NULL, 0);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(sdev->dev, "failed to create module %s\n", swidget->widget->name);
 
+		if (swidget->id != snd_soc_dapm_scheduler) {
+			struct sof_ipc4_fw_module *fw_module = swidget->module_info;
+
+			ida_free(&fw_module->m_ida, swidget->instance_id);
+		}
+	}
+
 	return ret;
 }
 
Signature · 1 line
2.37.3
maintainer
#1 lore raw
Quoted 8 lines · Peter Ujfalusi

The allocated ida needs to be freed up if the IPC message fails since next time when we try again to set up the widget we are going to try to allocate another ID and given enough tries, we are going to run out of unique IDs.

Fixes 711d0427c713 ("ASoC: SOF: ipc4-topology: move ida allocate/free to widget_setup/free")

[...]

Applied to

broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-topology: Free the ida when IPC fails in sof_ipc4_widget_setup()

      commit: 61eb0add28023119773d6aab8f402e149473920c

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