Skip to content

Commit

Permalink
ASoC: Don't oops in soc_probe_aux_dev in case of missing codec
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Jarkko Nikula authored and Mark Brown committed Dec 3, 2010
1 parent 4bd3a1f commit 676ad98
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;

Expand Down

0 comments on commit 676ad98

Please sign in to comment.