Skip to content

Commit c673efd

Browse files
shumingfanbroonie
authored andcommitted
ASoC: SDCA: fix finding wrong entity
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: 48fa77a ("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>
1 parent c991ca3 commit c673efd

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

sound/soc/sdca/sdca_functions.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,10 +1601,19 @@ static int find_sdca_entities(struct device *dev, struct sdw_slave *sdw,
16011601
static struct sdca_entity *find_sdca_entity_by_label(struct sdca_function_data *function,
16021602
const char *entity_label)
16031603
{
1604+
struct sdca_entity *entity = NULL;
16041605
int i;
16051606

16061607
for (i = 0; i < function->num_entities; i++) {
1607-
struct sdca_entity *entity = &function->entities[i];
1608+
entity = &function->entities[i];
1609+
1610+
/* check whole string first*/
1611+
if (!strcmp(entity->label, entity_label))
1612+
return entity;
1613+
}
1614+
1615+
for (i = 0; i < function->num_entities; i++) {
1616+
entity = &function->entities[i];
16081617

16091618
if (!strncmp(entity->label, entity_label, strlen(entity_label)))
16101619
return entity;

0 commit comments

Comments
 (0)