Skip to contentSkip to conversation

ASoC: Don't oops in soc_probe_aux_dev in case of missing codec

PATCH Applied Jarkko Nikula 3 participants 3 messages Dec 3, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Don't oops in soc_probe_aux_dev in case of missing codec

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.

---
 sound/soc/soc-core.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
sound/soc/soc-core.c +6 -2
index eb950f7..1fd5e72 100644
@@ -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;
 
Signature · 1 line
1.7.2.3
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jarkko Nikula

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.

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
Applied
#2 lore raw
In reply to Jarkko Nikula
Quoted 4 lines · Jarkko Nikula

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.