[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-id: <20190221094228.3778-1-s.nawrocki@samsung.com>
Date: Thu, 21 Feb 2019 10:42:28 +0100
From: Sylwester Nawrocki <s.nawrocki@...sung.com>
To: broonie@...nel.org, lgirdwood@...il.com
Cc: sbkim73@...sung.com, krzk@...nel.org, alsa-devel@...a-project.org,
linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org,
Sylwester Nawrocki <s.nawrocki@...sung.com>
Subject: [PATCH] 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");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Sylwester Nawrocki <s.nawrocki@...sung.com>
---
sound/soc/samsung/odroid.c | 8 ++++++--
1 file 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);
--
2.17.1
Powered by blists - more mailing lists