linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0
@ 2014-04-21 11:14 Nicolin Chen
  2014-04-23 12:49 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolin Chen @ 2014-04-21 11:14 UTC (permalink / raw)
  To: broonie; +Cc: alsa-devel, linux-kernel, lgirdwood, tiwai, perex

The commit e41975ed (ASoC: core: Fix the DAI name getting) added a break
within the "if (id < 0 || id >= pos->num_dai)" while the original design
of the search didn't break the loop if that condition contented but only
mark the ret error and let it go on to search the next component.

In a case like dmaengine which's not a dai but as a component sharing an
identical name with a dai, both the id and pos->num_dai here could be 0.
If we break the search, we may never find the dai we want as it might be
placed behind its dmaengine in the component list.

So this patch fixes the issue above by following the original design to
let the search carry on.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a17c047..82e9fdf 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4591,7 +4591,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
 
 			if (id < 0 || id >= pos->num_dai) {
 				ret = -EINVAL;
-				break;
+				continue;
 			}
 
 			ret = 0;
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0
  2014-04-21 11:14 [PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0 Nicolin Chen
@ 2014-04-23 12:49 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-04-23 12:49 UTC (permalink / raw)
  To: Nicolin Chen; +Cc: alsa-devel, linux-kernel, lgirdwood, tiwai, perex

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

On Mon, Apr 21, 2014 at 07:14:46PM +0800, Nicolin Chen wrote:
> The commit e41975ed (ASoC: core: Fix the DAI name getting) added a break
> within the "if (id < 0 || id >= pos->num_dai)" while the original design
> of the search didn't break the loop if that condition contented but only
> mark the ret error and let it go on to search the next component.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-23 12:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 11:14 [PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0 Nicolin Chen
2014-04-23 12:49 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).