From 1c0d023c8c2f7c56750a3d58207b263a39d39554 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Mon, 15 May 2023 11:52:00 +0300 Subject: ASoC: SOF: topology: Fix tuples array allocation The memory allocated for the tuples array assumes that there's 1 instance of all tokens already. So for those tokens that have multiple instances in topology, we need to exclude the initial instance that has already been accounted for. Fixes: 4fdef47a44d6 ("ASoC: SOF: ipc4-topology: Add new tokens for input/output pin format count") Signed-off-by: Ranjani Sridharan 1) { struct snd_sof_tuple *new_tuples; - num_tuples += token_list[object_token_list[i]].count * num_sets; + num_tuples += token_list[object_token_list[i]].count * (num_sets - 1); new_tuples = krealloc(swidget->tuples, sizeof(*new_tuples) * num_tuples, GFP_KERNEL); if (!new_tuples) { -- cgit v1.2.3