]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: Intel: add an empty adr_link
authorBard Liao <yung-chuan.liao@linux.intel.com>
Fri, 24 Apr 2026 10:50:31 +0000 (18:50 +0800)
committerMark Brown <broonie@kernel.org>
Sun, 26 Apr 2026 21:54:56 +0000 (06:54 +0900)
An empty adr_link is expected to terminate the
for (adr_link = mach_params->links; adr_link->num_adr; adr_link++) loop.
Allocate link_num + 1 links to add an empty adr_link.

Fixes: 5226d19d4cae5 ("ASoC: SOF: Intel: use sof_sdw as default SDW machine driver")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260424105031.114053-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.c

index b3d61d973ce40bc41f67cea27078fffdeec8d516..8662b422eb8074fb5ea3de7ea45347bcd8f97f52 100644 (file)
@@ -1412,7 +1412,8 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev
                link_mask |= BIT(peripherals->array[i]->bus->link_id);
 
        link_num = hweight32(link_mask);
-       links = devm_kcalloc(sdev->dev, link_num, sizeof(*links), GFP_KERNEL);
+       /* An empty adr_link is needed to terminate the adr_link loop */
+       links = devm_kcalloc(sdev->dev, link_num + 1, sizeof(*links), GFP_KERNEL);
        if (!links)
                return NULL;