Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S943162AbcJ0Oi0 (ORCPT ); Thu, 27 Oct 2016 10:38:26 -0400 Received: from queue01b.mail.zen.net.uk ([212.23.3.242]:40163 "EHLO queue01b.mail.zen.net.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S943112AbcJ0OiJ (ORCPT ); Thu, 27 Oct 2016 10:38:09 -0400 X-Greylist: delayed 1047 seconds by postgrey-1.27 at vger.kernel.org; Thu, 27 Oct 2016 10:38:09 EDT Message-ID: <1477568568.2908.14.camel@linaro.org> Subject: [PATCH] ASoC: hdmi-codec: Fix hdmi_of_xlate_dai_name when #sound-dai-cells = <0> From: "Jon Medhurst (Tixy)" To: Mark Brown , Kuninori Morimoto Cc: Jyri Sarha , Liam Girdwood , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org Date: Thu, 27 Oct 2016 12:42:48 +0100 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Originating-smarthost03c-IP: [82.69.122.217] Feedback-ID: 82.69.122.217 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1252 Lines: 38 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 --- Jyri, FYI, I believe this issue broke your commit df0bd1e8f3c508 ("ARM: dts: am335x-boneblack: Add HDMI audio support") sound/soc/codecs/hdmi-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index b904492..6661ace 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -364,7 +364,7 @@ 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 = args->args_count ? args->args[0] : 0; if (id < ARRAY_SIZE(hdmi_dai_name)) { *dai_name = hdmi_dai_name[id]; -- 2.1.4