All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen@rock-chips.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, tiwai@suse.de,
	dolinux.peng@gmail.com, Jaroslav Kysela <perex@perex.cz>,
	alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>
Subject: Re: [PATCH] ASoC: Add a sanity check before using dai driver name
Date: Wed, 23 Aug 2017 07:42:55 +0800	[thread overview]
Message-ID: <599CC17F.90806@rock-chips.com> (raw)
In-Reply-To: <20170822161756.5h6smkjz6kkvl5i7@sirena.org.uk>

hi Mark,

On 08/23/2017 12:17 AM, Mark Brown wrote:
> On Tue, Aug 22, 2017 at 10:45:12PM +0800, Jeffy Chen wrote:
>
>> -			return dai;
>> +			if (!dlc->dai_name)
>> +				return dai;
>> +			if (!strcmp(dai->name, dlc->dai_name))
>> +				return dai;
>
> You want (dlc->dai_name && !strcmp(dai->name, dlc->dai_name)) for this
> to be equivalent don't you?
i think the original check is allowing NULL dlc dai_name to be a match...
so we basically did:
reject when dlc dai_name is valid, but not match the dai name

and my patch is:
accept when dlc dai_name is invalid
accept when match dai name
accept when match dai driver name(only when it is valid)

so it's a "if (a && b) reject" to "if (!a || !b) accept" case..

>
>> +			if (dai->driver->name &&
>> +			    !strcmp(dai->driver->name, dlc->dai_name))
>

  reply	other threads:[~2017-08-22 23:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 14:45 [PATCH] ASoC: Add a sanity check before using dai driver name Jeffy Chen
2017-08-22 14:45 ` Jeffy Chen
2017-08-22 16:17 ` Mark Brown
2017-08-22 16:17   ` Mark Brown
2017-08-22 23:42   ` jeffy [this message]
2017-08-23 11:06     ` Mark Brown
2017-08-24  3:29       ` jeffy
2017-08-24 10:18         ` Mark Brown
2017-08-24 10:18           ` Mark Brown
2017-08-24 10:44           ` jeffy

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=599CC17F.90806@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dolinux.peng@gmail.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.