diff options
author | Jon Medhurst (Tixy) <tixy@linaro.org> | 2016-10-28 09:18:24 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-10-28 18:22:17 +0100 |
commit | 340327a62c4a145e098fd6c1116f12062eeec707 (patch) | |
tree | e202f7aa6fdbfbc07187fa6dd2c4d64aeb974371 /sound | |
parent | 1001354ca34179f3db924eb66672442a173147dc (diff) | |
download | linux-340327a62c4a145e098fd6c1116f12062eeec707.tar.gz linux-340327a62c4a145e098fd6c1116f12062eeec707.tar.bz2 linux-340327a62c4a145e098fd6c1116f12062eeec707.zip |
ASoC: hdmi-codec: Fix hdmi_of_xlate_dai_name when #sound-dai-cells = <0>
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: 9731f82d6016 ("ASoC: hdmi-codec: enable multi probe for same device")
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/hdmi-codec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index b904492d7744..90b5948e0ff3 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -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]; |