diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2019-10-11 11:43:12 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-10-14 12:58:55 +0100 |
commit | 8a3ab38c36926ddbda3d2a3086c0a741fa175cff (patch) | |
tree | f702daa486d1e85a851accc0193b29e77fe5a0b5 /sound/soc/sof/topology.c | |
parent | 494e8f65da24d550a5e7c6a85b9433ffb181705c (diff) | |
download | linux-8a3ab38c36926ddbda3d2a3086c0a741fa175cff.tar.bz2 |
ASoC: SOF: topology: check errors when parsing LED tokens
sof_parse_tokens() returns a value that is checked on every call
except for LED tokens, fix with explicit test.
Detected with cppcheck warning:
sound/soc/sof/topology.c:973:6: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens,
^
Fixes: 5d43001ae4360 ("ASoC: SOF: acpi led support for switch controls")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191011164312.7988-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/topology.c')
-rw-r--r-- | sound/soc/sof/topology.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 3fad1d5cb2ca..b3ab6f23fc93 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -963,6 +963,11 @@ out: ret = sof_parse_tokens(scomp, &scontrol->led_ctl, led_tokens, ARRAY_SIZE(led_tokens), mc->priv.array, le32_to_cpu(mc->priv.size)); + if (ret != 0) { + dev_err(sdev->dev, "error: parse led tokens failed %d\n", + le32_to_cpu(mc->priv.size)); + return ret; + } dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", scontrol->comp_id, scontrol->num_channels); |