mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cássio Gabriel Monteiro Pires" <cassiogabrielcontato@gmail.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: generic: keep fallback dai_name stable across rebind
Date: Fri, 27 Mar 2026 00:17:19 -0300	[thread overview]
Message-ID: <902117a1-8389-49c5-8c09-0566f1d8447e@gmail.com> (raw)
In-Reply-To: <877bqyxej1.wl-kuninori.morimoto.gx@renesas.com>

Hi, Kuninori

On 3/26/26 22:11, Kuninori Morimoto wrote:
> 
> Hi Cássio
> 
> Thank you for your patch
> 
>> simple_parse_dai() and graph_util_parse_dai() first try to identify a
>> DAI via dai_args. When that works the card can rebind without relying on
>> dlc->dai_name.
>>
>> The fallback path still calls snd_soc_get_dlc(), which returns a
>> borrowed dai_name pointer. If the CPU or codec component is unbound
>> while the sound card stays registered, the generic card keeps that
>> pointer and the next rebind may compare stale memory while matching the
>> DAI.
>>
>> Stage the fallback result in a temporary dai_link_component and move
>> only a card-owned copy of dai_name into the live link component. Use
>> devm_kstrdup_const() so static names are reused and dynamic ones remain
>> valid for the lifetime of the card device.
>>
>> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
>> ---
> 
> It looks good to me.
> 
> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> 1 concern is that this function is using goto, ad your code is fixing
> (A) part.
> 
> 	int graph_util_parse_dai(...)
> 	{
> 		...
> 		dai = snd_soc_get_dai_via_args(...);
> 		if (dai) {
> 			...
> =>			goto parse_dai_end;
> 		}
> 
> (A)		...
> 
> 	parse_dai_end:
> 		...
> 	}
> 
> 
> I think it is good timing to use if-else here ?
> 
> 	int graph_util_parse_dai(...)
> 	{
> 		...
> 		dai = snd_soc_get_dai_via_args(...);
> 		if (dai) {
> 			...
> +		} else {
> + (A)			...
> +		}
> 		...
> 	}
> 
> 

That makes sense, and it’s clearer.
I’m going to send the v2 patch with the changes.

> 
> Thank you for your help !!
> 
> Best regards
> ---
> Kuninori Morimoto

-- 
Thanks,
Cássio


      reply	other threads:[~2026-03-27  3:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 23:38 Cássio Gabriel
2026-03-27  1:11 ` Kuninori Morimoto
2026-03-27  3:17   ` Cássio Gabriel Monteiro Pires [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=902117a1-8389-49c5-8c09-0566f1d8447e@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®