]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ASoC: SOF: Intel: fix iteration in is_endpoint_present()
authorMaciej Strozek <mstrozek@opensource.cirrus.com>
Thu, 2 Apr 2026 06:45:31 +0000 (14:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:30:39 +0000 (13:30 +0200)
[ Upstream commit 1de6ddcddc954a69f96b1c23205e03ddd603e3c8 ]

is_endpoint_present() iterates over sdca_data.num_functions, but checks
the dai_type according to codec info list, which will cause problems if
not all endpoints from the codec info list are present. Make sure the
type of actually present functions is compared against target dai_type.

Fixes: 5226d19d4cae ("ASoC: SOF: Intel: use sof_sdw as default SDW machine driver")
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20260402064531.2287261-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/sof/intel/hda.c

index 882198308319ef06fc041229168bc5de89b571c9..b039306454da2656abb018421dd14b6bad9a086a 100644 (file)
@@ -1133,13 +1133,12 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev,
 
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
 
-static bool is_endpoint_present(struct sdw_slave *sdw_device,
-                               struct asoc_sdw_codec_info *dai_info, int dai_type)
+static bool is_endpoint_present(struct sdw_slave *sdw_device, int dai_type)
 {
        int i;
 
        for (i = 0; i < sdw_device->sdca_data.num_functions; i++) {
-               if (dai_type == dai_info->dais[i].dai_type)
+               if (dai_type == asoc_sdw_get_dai_type(sdw_device->sdca_data.function[i].type))
                        return true;
        }
        dev_dbg(&sdw_device->dev, "Endpoint DAI type %d not found\n", dai_type);
@@ -1193,8 +1192,7 @@ static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev,
                }
                for (j = 0; j < codec_info_list[i].dai_num; j++) {
                        /* Check if the endpoint is present by the SDCA DisCo table */
-                       if (!is_endpoint_present(sdw_device, &codec_info_list[i],
-                                                codec_info_list[i].dais[j].dai_type))
+                       if (!is_endpoint_present(sdw_device, codec_info_list[i].dais[j].dai_type))
                                continue;
 
                        endpoints[ep_index].num = j;