Skip to content

Commit

Permalink
ASoC: samsung: odroid: Prevent uninitialized variable use
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Sylwester Nawrocki authored and broonie committed Feb 21, 2019
1 parent 70b7732 commit 3af8160
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sound/soc/samsung/odroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3af8160

Please sign in to comment.