Commit 2ae548f3 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Check return value of soc_tplg_*_create

Functions soc_tplg_denum_create, soc_tplg_dmixer_create,
soc_tplg_dbytes_create can fail, so their return values should be
checked and error should be propagated.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200327204729.397-4-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 482db55a
...@@ -1124,6 +1124,7 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, ...@@ -1124,6 +1124,7 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
struct snd_soc_tplg_hdr *hdr) struct snd_soc_tplg_hdr *hdr)
{ {
struct snd_soc_tplg_ctl_hdr *control_hdr; struct snd_soc_tplg_ctl_hdr *control_hdr;
int ret;
int i; int i;
if (tplg->pass != SOC_TPLG_PASS_MIXER) { if (tplg->pass != SOC_TPLG_PASS_MIXER) {
...@@ -1152,25 +1153,30 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg, ...@@ -1152,25 +1153,30 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
case SND_SOC_TPLG_CTL_RANGE: case SND_SOC_TPLG_CTL_RANGE:
case SND_SOC_TPLG_DAPM_CTL_VOLSW: case SND_SOC_TPLG_DAPM_CTL_VOLSW:
case SND_SOC_TPLG_DAPM_CTL_PIN: case SND_SOC_TPLG_DAPM_CTL_PIN:
soc_tplg_dmixer_create(tplg, 1, ret = soc_tplg_dmixer_create(tplg, 1,
le32_to_cpu(hdr->payload_size)); le32_to_cpu(hdr->payload_size));
break; break;
case SND_SOC_TPLG_CTL_ENUM: case SND_SOC_TPLG_CTL_ENUM:
case SND_SOC_TPLG_CTL_ENUM_VALUE: case SND_SOC_TPLG_CTL_ENUM_VALUE:
case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE: case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT: case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE: case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
soc_tplg_denum_create(tplg, 1, ret = soc_tplg_denum_create(tplg, 1,
le32_to_cpu(hdr->payload_size)); le32_to_cpu(hdr->payload_size));
break; break;
case SND_SOC_TPLG_CTL_BYTES: case SND_SOC_TPLG_CTL_BYTES:
soc_tplg_dbytes_create(tplg, 1, ret = soc_tplg_dbytes_create(tplg, 1,
le32_to_cpu(hdr->payload_size)); le32_to_cpu(hdr->payload_size));
break; break;
default: default:
soc_bind_err(tplg, control_hdr, i); soc_bind_err(tplg, control_hdr, i);
return -EINVAL; return -EINVAL;
} }
if (ret < 0) {
dev_err(tplg->dev, "ASoC: invalid control\n");
return ret;
}
} }
return 0; return 0;
......
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