Commit 3ce57f22 authored by Amadeusz Sławiński's avatar Amadeusz Sławiński Committed by Mark Brown

ASoC: topology: Remove superfluous error prints

soc_tplg_check_elem_count(), already prints an error when applicable, so
there is no need to print another one.

Also clean up alignment of arguments in if, so there is no confusion
about what is checked and what is executed if condition is true.
Signed-off-by: default avatarAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220112170030.569712-2-amadeuszx.slawinski@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6cbff4b3
...@@ -685,12 +685,9 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, unsigned int count, ...@@ -685,12 +685,9 @@ static int soc_tplg_dbytes_create(struct soc_tplg *tplg, unsigned int count,
int err = 0; int err = 0;
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
sizeof(struct snd_soc_tplg_bytes_control), count, sizeof(struct snd_soc_tplg_bytes_control),
size, "mixer bytes")) { count, size, "mixer bytes"))
dev_err(tplg->dev, "ASoC: Invalid count %d for byte control\n",
count);
return -EINVAL; return -EINVAL;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
be = (struct snd_soc_tplg_bytes_control *)tplg->pos; be = (struct snd_soc_tplg_bytes_control *)tplg->pos;
...@@ -763,13 +760,9 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count, ...@@ -763,13 +760,9 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
int err = 0; int err = 0;
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
sizeof(struct snd_soc_tplg_mixer_control), sizeof(struct snd_soc_tplg_mixer_control),
count, size, "mixers")) { count, size, "mixers"))
dev_err(tplg->dev, "ASoC: invalid count %d for controls\n",
count);
return -EINVAL; return -EINVAL;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
mc = (struct snd_soc_tplg_mixer_control *)tplg->pos; mc = (struct snd_soc_tplg_mixer_control *)tplg->pos;
...@@ -927,13 +920,9 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count, ...@@ -927,13 +920,9 @@ static int soc_tplg_denum_create(struct soc_tplg *tplg, unsigned int count,
int err = 0; int err = 0;
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
sizeof(struct snd_soc_tplg_enum_control), sizeof(struct snd_soc_tplg_enum_control),
count, size, "enums")) { count, size, "enums"))
dev_err(tplg->dev, "ASoC: invalid count %d for enum controls\n",
count);
return -EINVAL; return -EINVAL;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
ec = (struct snd_soc_tplg_enum_control *)tplg->pos; ec = (struct snd_soc_tplg_enum_control *)tplg->pos;
...@@ -1111,13 +1100,9 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg, ...@@ -1111,13 +1100,9 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
count = le32_to_cpu(hdr->count); count = le32_to_cpu(hdr->count);
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
sizeof(struct snd_soc_tplg_dapm_graph_elem), sizeof(struct snd_soc_tplg_dapm_graph_elem),
count, le32_to_cpu(hdr->payload_size), "graph")) { count, le32_to_cpu(hdr->payload_size), "graph"))
dev_err(tplg->dev, "ASoC: invalid count %d for DAPM routes\n",
count);
return -EINVAL; return -EINVAL;
}
dev_dbg(tplg->dev, "ASoC: adding %d DAPM routes for index %d\n", count, dev_dbg(tplg->dev, "ASoC: adding %d DAPM routes for index %d\n", count,
hdr->index); hdr->index);
...@@ -1965,11 +1950,8 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg, ...@@ -1965,11 +1950,8 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg,
size, count, size, count,
le32_to_cpu(hdr->payload_size), le32_to_cpu(hdr->payload_size),
"PCM DAI")) { "PCM DAI"))
dev_err(tplg->dev, "ASoC: invalid count %d for PCM DAI elems\n",
count);
return -EINVAL; return -EINVAL;
}
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
pcm = (struct snd_soc_tplg_pcm *)tplg->pos; pcm = (struct snd_soc_tplg_pcm *)tplg->pos;
...@@ -2243,14 +2225,10 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg, ...@@ -2243,14 +2225,10 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
return -EINVAL; return -EINVAL;
} }
if (soc_tplg_check_elem_count(tplg, if (soc_tplg_check_elem_count(tplg, size, count,
size, count,
le32_to_cpu(hdr->payload_size), le32_to_cpu(hdr->payload_size),
"physical link config")) { "physical link config"))
dev_err(tplg->dev, "ASoC: invalid count %d for physical link elems\n",
count);
return -EINVAL; return -EINVAL;
}
/* config physical DAI links */ /* config physical DAI links */
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
......
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