]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: topology: allocate string for tuples
authorBard Liao <yung-chuan.liao@linux.intel.com>
Mon, 14 Apr 2025 06:32:29 +0000 (14:32 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 14 Apr 2025 10:22:16 +0000 (11:22 +0100)
In preparation to handle tuples from multiple topologies, duplicate the
tuple string value by allocating memory for it.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://patch.msgid.link/20250414063239.85200-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c

index dc9cb8324067831846b865f75e2f530c57e59062..15e8ca62ab14216c36ceba34a7c5b9fbb1f051fe 100644 (file)
@@ -571,7 +571,11 @@ static int sof_copy_tuples(struct snd_sof_dev *sdev, struct snd_soc_tplg_vendor_
                                                continue;
 
                                        tuples[*num_copied_tuples].token = tokens[j].token;
-                                       tuples[*num_copied_tuples].value.s = elem->string;
+                                       tuples[*num_copied_tuples].value.s =
+                                               devm_kasprintf(sdev->dev, GFP_KERNEL,
+                                                              "%s", elem->string);
+                                       if (!tuples[*num_copied_tuples].value.s)
+                                               return -ENOMEM;
                                } else {
                                        struct snd_soc_tplg_vendor_value_elem *elem;