Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1718802 > unrolled thread

[PATCH v2] ASoC: Add a sanity check before using dai driver name

Started byJeffy Chen <jeffy.chen@rock-chips.com>
First post2017-08-24 05:40 +0200
Last post2017-08-24 06:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] ASoC: Add a sanity check before using dai driver name Jeffy Chen <jeffy.chen@rock-chips.com> - 2017-08-24 05:40 +0200
    Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name Donglin Peng <dolinux.peng@gmail.com> - 2017-08-24 05:50 +0200
      Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name jeffy <jeffy.chen@rock-chips.com> - 2017-08-24 06:50 +0200

#1718802 — [PATCH v2] ASoC: Add a sanity check before using dai driver name

FromJeffy Chen <jeffy.chen@rock-chips.com>
Date2017-08-24 05:40 +0200
Subject[PATCH v2] ASoC: Add a sanity check before using dai driver name
Message-ID<uhR9T-113-5@gated-at.bofh.it>
The dai driver's name is allowed to be NULL. So add a sanity check for
that.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reported-by: Donglin Peng <dolinux.peng@gmail.com>
---

Changes in v2:
Keep the oringinal check style.

 sound/soc/soc-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index fc1bb2da3e2e..c38c8f844546 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1029,7 +1029,8 @@ struct snd_soc_dai *snd_soc_find_dai(
 			continue;
 		list_for_each_entry(dai, &component->dai_list, list) {
 			if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
-			    && strcmp(dai->driver->name, dlc->dai_name))
+			    && (!dai->driver->name
+				|| !strcmp(dai->driver->name, dlc->dai_name))
 				continue;
 
 			return dai;
-- 
2.11.0

[toc] | [next] | [standalone]


#1718804

FromDonglin Peng <dolinux.peng@gmail.com>
Date2017-08-24 05:50 +0200
Message-ID<uhRjz-14f-5@gated-at.bofh.it>
In reply to#1718802
On Thu, Aug 24, 2017 at 11:34 AM, Jeffy Chen <jeffy.chen@rock-chips.com> wrote:
>                 list_for_each_entry(dai, &component->dai_list, list) {
>                         if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
> -                           && strcmp(dai->driver->name, dlc->dai_name))
> +                           && (!dai->driver->name
> +                               || !strcmp(dai->driver->name, dlc->dai_name))
>                                 continue;

If the dai->driver->name is match with the dlc->dai_name, does it need
to continue?

>
>                         return dai;

[toc] | [prev] | [next] | [standalone]


#1718822

Fromjeffy <jeffy.chen@rock-chips.com>
Date2017-08-24 06:50 +0200
Message-ID<uhSfE-1F9-9@gated-at.bofh.it>
In reply to#1718804
Hi Dong,

Thanks for noticing, will send new patch soon :)

On 08/24/2017 11:46 AM, Donglin Peng wrote:
> On Thu, Aug 24, 2017 at 11:34 AM, Jeffy Chen <jeffy.chen@rock-chips.com> wrote:
>>                  list_for_each_entry(dai, &component->dai_list, list) {
>>                          if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
>> -                           && strcmp(dai->driver->name, dlc->dai_name))
>> +                           && (!dai->driver->name
>> +                               || !strcmp(dai->driver->name, dlc->dai_name))
>>                                  continue;
>
> If the dai->driver->name is match with the dlc->dai_name, does it need
> to continue?

hmm, sorry, i did this in a hurry, should setup my board and test it..
>
>>
>>                          return dai;
>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web