ASoC: simple-card-utils: fix build warning without CONFIG_OF

When CONFIG_OF is disabled, of_graph_parse_endpoint() does not
initialize 'info', and gcc can see that:

sound/soc/generic/simple-card-utils.c: In function 'asoc_simple_card_parse_graph_dai':
sound/soc/generic/simple-card-utils.c:284:13: error: 'info.port' may be used uninitialized in this function [-Werror=maybe-uninitialized]

It's probably best to check the return code anyway, and that also
takes care of the warning.

Fixes: b6f3fc005a ("ASoC: simple-card-utils: fixup asoc_simple_card_get_dai_id() counting")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Arnd Bergmann 2018-12-10 21:46:10 +01:00 committed by Mark Brown
parent e9dc919043
commit 2b320e0464
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 4 additions and 1 deletions

View File

@ -280,7 +280,10 @@ static int asoc_simple_card_get_dai_id(struct device_node *ep)
* Non HDMI sound case, counting port/endpoint on its DT
* is enough. Let's count it.
*/
of_graph_parse_endpoint(ep, &info);
ret = of_graph_parse_endpoint(ep, &info);
if (ret)
return -ENXIO;
return info.port;
}