summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2019-02-21 10:42:28 +0100
committerSylwester Nawrocki <s.nawrocki@samsung.com>2019-03-04 18:05:33 +0100
commit48e666b5772d8c5e9bc4423474cccc75270fec61 (patch)
treef16a30eeb1988d0548e046d17eaa18cf053917b4
parentd78ff27418486a7462ea27f1ad5c86ca72556431 (diff)
downloadlinux-exynos-48e666b5772d8c5e9bc4423474cccc75270fec61.tar.gz
linux-exynos-48e666b5772d8c5e9bc4423474cccc75270fec61.tar.bz2
linux-exynos-48e666b5772d8c5e9bc4423474cccc75270fec61.zip
ASoC: samsung: odroid: Prevent uninitialized variable use
This addresses an issue pointed out by compiler warning: sound/soc/samsung/odroid.c: In function ‘odroid_audio_probe’: sound/soc/samsung/odroid.c:298:22: warning: ‘cpu_dai’ may be used uninitialized in this function [-Wmaybe-uninitialized] priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I39c6dd0a1aa5ec68bfc17c895988c21a1a34733e Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/samsung/odroid.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/samsung/odroid.c b/sound/soc/samsung/odroid.c
index c3b0f6c612cb..694512f980fd 100644
--- a/sound/soc/samsung/odroid.c
+++ b/sound/soc/samsung/odroid.c
@@ -194,7 +194,8 @@ static struct snd_soc_dai_link odroid_card_dais[] = {
static int odroid_audio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
- struct device_node *cpu, *cpu_dai, *codec;
+ struct device_node *cpu_dai = NULL;
+ struct device_node *cpu, *codec;
struct odroid_priv *priv;
struct snd_soc_card *card;
struct snd_soc_dai_link *link, *codec_link;
@@ -271,8 +272,11 @@ static int odroid_audio_probe(struct platform_device *pdev)
if (ret < 0)
break;
}
- if (ret == 0)
+ if (ret == 0) {
cpu_dai = of_parse_phandle(cpu, "sound-dai", 0);
+ if (!cpu_dai)
+ ret = -EINVAL;
+ }
of_node_put(cpu);
of_node_put(codec);