ASoC: SDCA: fix finding wrong entity
Subsystems (3)
PATCH v2 2/2 ASoC: SDCA: fix finding wrong entity
From: Shuming Fan <[email protected]>
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.
--- sound/soc/sdca/sdca_functions.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
sound/soc/sdca/sdca_functions.c +10 -1
@@ -1601,10 +1601,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;
Signature · 1 line
2.53.0
Mark Brown
maintainerQuoted 6 lines · On Wed, Mar 25, 2026 at 07:04:06PM +0800, [email protected] wrote:
From: Shuming Fan <[email protected]>
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.
Please don't send individual patches with series numbering that are not part of a series, the numbering only makes sense within a series to order things. Individual patches shouldn't be numbered, and the numbers should reflect that series itself.
Your threading is also broken on the seriese that you do send, they just appear as separate sends without any threaded.
Quoted 10 lines · On Wed, Mar 25, 2026 at 07:04:06PM +0800, [email protected] wrote:
From: Shuming Fan <[email protected]>
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")Signed-off-by Shuming Fan <[email protected]>---
Thanks,
Charles