* [PATCH 2/2] ASoC: SDCA: fix finding wrong entity
@ 2026-03-25 9:20 shumingf
2026-03-25 10:16 ` Charles Keepax
0 siblings, 1 reply; 3+ messages in thread
From: shumingf @ 2026-03-25 9:20 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: linux-sound, lars, flove, oder_chiou, jack.yu, derek.fang,
ckeepax, Shuming Fan
From: Shuming Fan <shumingf@realtek.com>
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.
Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
sound/soc/sdca/sdca_functions.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index 0b7d97dcb236..0787bf024d21 100644
--- a/sound/soc/sdca/sdca_functions.c
+++ b/sound/soc/sdca/sdca_functions.c
@@ -1602,9 +1602,18 @@ static struct sdca_entity *find_sdca_entity_by_label(struct sdca_function_data *
const char *entity_label)
{
int i;
+ struct sdca_entity *entity = NULL;
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;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 2/2] ASoC: SDCA: fix finding wrong entity
2026-03-25 9:20 [PATCH 2/2] ASoC: SDCA: fix finding wrong entity shumingf
@ 2026-03-25 10:16 ` Charles Keepax
2026-03-25 10:51 ` Shuming [范書銘]
0 siblings, 1 reply; 3+ messages in thread
From: Charles Keepax @ 2026-03-25 10:16 UTC (permalink / raw)
To: shumingf
Cc: broonie, lgirdwood, linux-sound, lars, flove, oder_chiou, jack.yu,
derek.fang
On Wed, Mar 25, 2026 at 05:20:28PM +0800, shumingf@realtek.com wrote:
> From: Shuming Fan <shumingf@realtek.com>
>
> 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.
>
> Signed-off-by: Shuming Fan <shumingf@realtek.com>
Could use a fixes tag:
Fixes: 48fa77af2f4a ("ASoC: SDCA: Add terminal type into input/output widget name")
> ---
> sound/soc/sdca/sdca_functions.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
> index 0b7d97dcb236..0787bf024d21 100644
> --- a/sound/soc/sdca/sdca_functions.c
> +++ b/sound/soc/sdca/sdca_functions.c
> @@ -1602,9 +1602,18 @@ static struct sdca_entity *find_sdca_entity_by_label(struct sdca_function_data *
> const char *entity_label)
> {
> int i;
> + struct sdca_entity *entity = NULL;
Minor nit put this above the int i;
But looks like a good fix, thanks for spotting that.
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread* RE: [PATCH 2/2] ASoC: SDCA: fix finding wrong entity
2026-03-25 10:16 ` Charles Keepax
@ 2026-03-25 10:51 ` Shuming [范書銘]
0 siblings, 0 replies; 3+ messages in thread
From: Shuming [范書銘] @ 2026-03-25 10:51 UTC (permalink / raw)
To: Charles Keepax
Cc: broonie@kernel.org, lgirdwood@gmail.com,
linux-sound@vger.kernel.org, lars@metafoo.de, Flove(HsinFu),
Oder Chiou, Jack Yu, Derek [方德義]
> > 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.
> >
> > Signed-off-by: Shuming Fan <shumingf@realtek.com>
>
> Could use a fixes tag:
>
> Fixes: 48fa77af2f4a ("ASoC: SDCA: Add terminal type into input/output widget
> name")
Will add the fixed tag.
> > ---
> > sound/soc/sdca/sdca_functions.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/sdca/sdca_functions.c
> > b/sound/soc/sdca/sdca_functions.c index 0b7d97dcb236..0787bf024d21
> > 100644
> > --- a/sound/soc/sdca/sdca_functions.c
> > +++ b/sound/soc/sdca/sdca_functions.c
> > @@ -1602,9 +1602,18 @@ static struct sdca_entity
> *find_sdca_entity_by_label(struct sdca_function_data *
> > const char
> > *entity_label) {
> > int i;
> > + struct sdca_entity *entity = NULL;
>
> Minor nit put this above the int i;
Sure, will fix
> But looks like a good fix, thanks for spotting that.
>
> Thanks,
> Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-25 10:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 9:20 [PATCH 2/2] ASoC: SDCA: fix finding wrong entity shumingf
2026-03-25 10:16 ` Charles Keepax
2026-03-25 10:51 ` Shuming [范書銘]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox