Skip to content

Commit

Permalink
ASoC: hdmi-codec: Fix hdmi_of_xlate_dai_name when #sound-dai-cells = <0>
Browse files Browse the repository at this point in the history
If a DAI specifies "#sound-dai-cells = <0>" in device-tree then
hdmi_of_xlate_dai_name() will be called with zero args, which it isn't
implemented to cope with. The resulting use of an uninitialised variable
for the id will usually result in an error like:

  asoc-simple-card sound: parse error -11
  asoc-simple-card: probe of sound failed with error -11

Fix this by using and id of zero if no arg is provided.

Fixes: 9731f82 ("ASoC: hdmi-codec: enable multi probe for same device")

Signed-off-by: Jon Medhurst <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
tixy authored and broonie committed Oct 28, 2016
1 parent 1001354 commit 340327a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sound/soc/codecs/hdmi-codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ static int hdmi_of_xlate_dai_name(struct snd_soc_component *component,
struct of_phandle_args *args,
const char **dai_name)
{
int id = args->args[0];
int id;

if (args->args_count)
id = args->args[0];
else
id = 0;

if (id < ARRAY_SIZE(hdmi_dai_name)) {
*dai_name = hdmi_dai_name[id];
Expand Down

0 comments on commit 340327a

Please sign in to comment.