Commit c437ba03 authored by Colin Ian King's avatar Colin Ian King Committed by Mark Brown

ASoC: SOF: remove redundant null checks of dai

Currently there are two null checks of pointer dai in function
sof_connect_dai_widget and yet there is no null check of dai
at the end of the function when checking !dai->name.  The latter
would be a null pointer deference if dai is null (as picked up
by static analysis), however the function is only ever called
when dai is successfully allocated, so the null checks are
redundant. Clean up the code by removing the null checks.

Addresses-Coverity: ("Dereference after null check")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1cd472d2
...@@ -1127,15 +1127,13 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, ...@@ -1127,15 +1127,13 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
switch (w->id) { switch (w->id) {
case snd_soc_dapm_dai_out: case snd_soc_dapm_dai_out:
rtd->cpu_dai->capture_widget = w; rtd->cpu_dai->capture_widget = w;
if (dai) dai->name = rtd->dai_link->name;
dai->name = rtd->dai_link->name;
dev_dbg(sdev->dev, "tplg: connected widget %s -> DAI link %s\n", dev_dbg(sdev->dev, "tplg: connected widget %s -> DAI link %s\n",
w->name, rtd->dai_link->name); w->name, rtd->dai_link->name);
break; break;
case snd_soc_dapm_dai_in: case snd_soc_dapm_dai_in:
rtd->cpu_dai->playback_widget = w; rtd->cpu_dai->playback_widget = w;
if (dai) dai->name = rtd->dai_link->name;
dai->name = rtd->dai_link->name;
dev_dbg(sdev->dev, "tplg: connected widget %s -> DAI link %s\n", dev_dbg(sdev->dev, "tplg: connected widget %s -> DAI link %s\n",
w->name, rtd->dai_link->name); w->name, rtd->dai_link->name);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment