All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec
@ 2010-12-03  7:18 Jarkko Nikula
  2010-12-03 11:57 ` Liam Girdwood
  2010-12-03 12:27 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Jarkko Nikula @ 2010-12-03  7:18 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

Blind copy of codec finding algorithm from soc_bind_dai_link does not work
in soc_probe_aux_dev if matching codec name is not found. In that case the
code falls through and tries to start the probing procedure with invalid
codec pointer.

Fix this and add an error print showing the codec name that cannot be found.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
 sound/soc/soc-core.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index eb950f7..1fd5e72 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1609,7 +1609,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
 	struct snd_soc_pcm_runtime *rtd = &card->rtd_aux[num];
 	struct snd_soc_codec *codec;
 	const char *temp;
-	int ret = 0;
+	int ret = -ENODEV;
 
 	/* find CODEC from registered CODECs*/
 	list_for_each_entry(codec, &codec_list, list) {
@@ -1620,10 +1620,14 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
 				ret = -EBUSY;
 				goto out;
 			}
-			break;
+			goto found;
 		}
 	}
+	/* codec not found */
+	dev_err(card->dev, "asoc: codec %s not found", aux_dev->codec_name);
+	goto out;
 
+found:
 	if (!try_module_get(codec->dev->driver->owner))
 		return -ENODEV;
 
-- 
1.7.2.3

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

* Re: [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec
  2010-12-03  7:18 [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec Jarkko Nikula
@ 2010-12-03 11:57 ` Liam Girdwood
  2010-12-03 12:27 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-12-03 11:57 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown

On Fri, 2010-12-03 at 09:18 +0200, Jarkko Nikula wrote:
> Blind copy of codec finding algorithm from soc_bind_dai_link does not work
> in soc_probe_aux_dev if matching codec name is not found. In that case the
> code falls through and tries to start the probing procedure with invalid
> codec pointer.
> 
> Fix this and add an error print showing the codec name that cannot be found.
> 
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>

-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

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

* Re: [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec
  2010-12-03  7:18 [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec Jarkko Nikula
  2010-12-03 11:57 ` Liam Girdwood
@ 2010-12-03 12:27 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-12-03 12:27 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Liam Girdwood

On Fri, Dec 03, 2010 at 09:18:22AM +0200, Jarkko Nikula wrote:
> Blind copy of codec finding algorithm from soc_bind_dai_link does not work
> in soc_probe_aux_dev if matching codec name is not found. In that case the
> code falls through and tries to start the probing procedure with invalid
> codec pointer.

Applied, thanks.

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

end of thread, other threads:[~2010-12-03 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03  7:18 [PATCH] ASoC: Don't oops in soc_probe_aux_dev in case of missing codec Jarkko Nikula
2010-12-03 11:57 ` Liam Girdwood
2010-12-03 12:27 ` Mark Brown

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.