[PATCH v3 1/3] ASoC: dapm: Fix widget lookup with snd_soc_dapm_widget_name_cmp()

Mark Brown broonie at kernel.org
Mon May 4 19:21:19 PDT 2026


On Wed, Apr 29, 2026 at 11:12:50AM +0900, Chancel Liu wrote:
> Currently dapm_find_widget() manually constructs a prefixed widget name
> based on the provided DAPM context and compares it using strcmp(). This
> happens to work in most cases because callers usually know which DAPM
> context the target widget belongs to and pass in the matching DAPM
> context.

> -	if (prefix) {
> -		snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
> -			 prefix, pin);
> -		pin_name = prefixed_pin;
> -	} else {
> -		pin_name = pin;
> -	}
>  
>  	for_each_card_widgets(dapm->card, w) {
> -		if (!strcmp(w->name, pin_name)) {
> +		if (!snd_soc_dapm_widget_name_cmp(w, pin)) {
>  			if (w->dapm == dapm)
>  				return w;
>  			else

This means we can't use the prefix to disambiguate any more -
snd_soc_dapm_widget_name_cmp() will strip the prefix off.  We want the
prefix in contexts where the name is specified by the user since the
prefix is there to provide for disambiguation.  The prefix addition
logic is a bit weird and I'm not sure it makes sense, but the search
based on the fully specified name we got is something we want.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260505/847e48e5/attachment.sig>


More information about the linux-arm-kernel mailing list