mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
@ 2013-12-20  6:39 Xiubo Li
  2013-12-20  6:39 ` [PATCH] ASoC: soc-core: Fix the DAI name getting Xiubo Li
  2013-12-21 14:42 ` [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Xiubo Li @ 2013-12-20  6:39 UTC (permalink / raw)
  To: broonie, perex, tiwai, kuninori.morimoto.gx
  Cc: fabio.estevam, alsa-devel, linux-kernel

The name of cpu DAI maybe omitted, and then strlen() will lead
kernel panic.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/generic/simple-card.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 3d190d0..1d87db8 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -142,6 +142,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (ret < 0)
 		return ret;
 
+	if (!info->cpu_dai.name || !info->codec_dai.name)
+		return -EINVAL;
+
 	/* card name is created from CPU/CODEC dai name */
 	name = devm_kzalloc(dev,
 			    strlen(info->cpu_dai.name)   +
-- 
1.8.4



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

* [PATCH] ASoC: soc-core: Fix the DAI name getting.
  2013-12-20  6:39 [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Xiubo Li
@ 2013-12-20  6:39 ` Xiubo Li
  2013-12-31 16:30   ` Mark Brown
  2013-12-21 14:42 ` [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Xiubo Li @ 2013-12-20  6:39 UTC (permalink / raw)
  To: broonie, perex, tiwai, kuninori.morimoto.gx
  Cc: fabio.estevam, alsa-devel, linux-kernel

>From "ASoC: make snd_soc_dai_link more symmetrical", can we see that
the name of CPU DAI maybe omitted. If the DAI name is omitted, try to
use the component name instead.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/soc-core.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a66783e..be88df5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4617,10 +4617,14 @@ int snd_soc_of_get_dai_name(struct device_node *of_node,
 
 			if (id < 0 || id >= pos->num_dai) {
 				ret = -EINVAL;
-			} else {
-				*dai_name = pos->dai_drv[id].name;
-				ret = 0;
+				break;
 			}
+
+			ret = 0;
+
+			*dai_name = pos->dai_drv[id].name;
+			if (!*dai_name)
+				*dai_name = pos->name;
 		}
 
 		break;
-- 
1.8.4



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

* Re: [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
  2013-12-20  6:39 [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Xiubo Li
  2013-12-20  6:39 ` [PATCH] ASoC: soc-core: Fix the DAI name getting Xiubo Li
@ 2013-12-21 14:42 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-12-21 14:42 UTC (permalink / raw)
  To: Xiubo Li
  Cc: perex, tiwai, kuninori.morimoto.gx, fabio.estevam, alsa-devel,
	linux-kernel

On Fri, Dec 20, 2013 at 02:39:50PM +0800, Xiubo Li wrote:
> The name of cpu DAI maybe omitted, and then strlen() will lead
> kernel panic.

Applied, thanks.

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

* Re: [PATCH] ASoC: soc-core: Fix the DAI name getting.
  2013-12-20  6:39 ` [PATCH] ASoC: soc-core: Fix the DAI name getting Xiubo Li
@ 2013-12-31 16:30   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-12-31 16:30 UTC (permalink / raw)
  To: Xiubo Li
  Cc: perex, tiwai, kuninori.morimoto.gx, fabio.estevam, alsa-devel,
	linux-kernel

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

On Fri, Dec 20, 2013 at 02:39:51PM +0800, Xiubo Li wrote:
> From "ASoC: make snd_soc_dai_link more symmetrical", can we see that
> the name of CPU DAI maybe omitted. If the DAI name is omitted, try to
> use the component name instead.

Applied, thanks.

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

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

end of thread, other threads:[~2013-12-31 16:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-20  6:39 [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Xiubo Li
2013-12-20  6:39 ` [PATCH] ASoC: soc-core: Fix the DAI name getting Xiubo Li
2013-12-31 16:30   ` Mark Brown
2013-12-21 14:42 ` [PATCH] ASoC: simple-card: Add cpu_dai and codec_dai names NULL check Mark Brown

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®