summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShuming Fan <shumingf@realtek.com>2026-03-25 19:04:06 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-04-02 13:25:36 +0200
commit37ebef31922101024fd8085ec6ff493d6277cf6b (patch)
treef9aaa933409d657d0aed45b9fcbb9b36464643c7 /sound
parentcafe79ebaae9ac5747d018046bc2c9faff28d8e5 (diff)
ASoC: SDCA: fix finding wrong entity
[ Upstream commit c673efd5db2223c2e8b885025bcd96bca6cdb171 ] This patch fixes an issue like: where searching for the entity 'FU 11' could incorrectly match 'FU 113' first. The driver should first perform an exact match on the full string name. If no exact match is found, it can then fall back to a partial match. Fixes: 48fa77af2f4a ("ASoC: SDCA: Add terminal type into input/output widget name") Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://patch.msgid.link/20260325110406.3232420-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sdca/sdca_functions.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index d2de9e81b4f9..a1f6f931a808 100644
--- a/sound/soc/sdca/sdca_functions.c
+++ b/sound/soc/sdca/sdca_functions.c
@@ -1568,10 +1568,19 @@ static int find_sdca_entities(struct device *dev, struct sdw_slave *sdw,
static struct sdca_entity *find_sdca_entity_by_label(struct sdca_function_data *function,
const char *entity_label)
{
+ struct sdca_entity *entity = NULL;
int i;
for (i = 0; i < function->num_entities; i++) {
- struct sdca_entity *entity = &function->entities[i];
+ entity = &function->entities[i];
+
+ /* check whole string first*/
+ if (!strcmp(entity->label, entity_label))
+ return entity;
+ }
+
+ for (i = 0; i < function->num_entities; i++) {
+ entity = &function->entities[i];
if (!strncmp(entity->label, entity_label, strlen(entity_label)))
return entity;