summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2020-10-19 11:17:21 +0200
committerJaroslav Kysela <perex@perex.cz>2020-10-19 11:17:21 +0200
commite91b1c0670de7fbcae2b957b6117de38ddbea87b (patch)
tree5c26fe8731755add6f6ceae54d57ed057b45882d
parent5c1cb568ec76c5f9acb11ef092d65f05cf748940 (diff)
downloadalsa-lib-e91b1c0670de7fbcae2b957b6117de38ddbea87b.tar.gz
topology: straight printf and error path fixes
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/topology/ctl.c4
-rw-r--r--src/topology/dapm.c2
-rw-r--r--src/topology/data.c22
3 files changed, 15 insertions, 13 deletions
diff --git a/src/topology/ctl.c b/src/topology/ctl.c
index a3839963..dd05424d 100644
--- a/src/topology/ctl.c
+++ b/src/topology/ctl.c
@@ -879,9 +879,9 @@ int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
if (err >= 0 && mc->max > 0)
err = tplg_save_printf(dst, pfx, "\tmax %u\n", mc->max);
if (err >= 0 && mc->invert > 0)
- err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max);
+ err = tplg_save_printf(dst, pfx, "\tinvert 1\n");
if (err >= 0 && mc->invert > 0)
- err = tplg_save_printf(dst, pfx, "\tinvert 1\n", mc->max);
+ err = tplg_save_printf(dst, pfx, "\tinvert 1\n");
if (err >= 0)
err = tplg_save_ops(tplg, &mc->hdr, dst, pfx2);
if (err >= 0)
diff --git a/src/topology/dapm.c b/src/topology/dapm.c
index 46f2f8b3..92dc01aa 100644
--- a/src/topology/dapm.c
+++ b/src/topology/dapm.c
@@ -483,7 +483,7 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index,
}
if (first) {
first = 0;
- err = tplg_save_printf(dst, pfx, "\t\tlines [\n", elem->index);
+ err = tplg_save_printf(dst, pfx, "\t\tlines [\n");
if (err < 0)
return err;
}
diff --git a/src/topology/data.c b/src/topology/data.c
index 3585af30..c2931bd2 100644
--- a/src/topology/data.c
+++ b/src/topology/data.c
@@ -930,6 +930,8 @@ static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples,
err = tplg_save_printf(dst, pfx, "\t'%s' ",
tuple->token);
}
+ if (err < 0)
+ return err;
switch (set->type) {
case SND_SOC_TPLG_TUPLE_TYPE_UUID:
err = tplg_save_printf(dst, NULL, "'" UUID_FORMAT "'\n",
@@ -1276,9 +1278,9 @@ int tplg_save_manifest_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
elem->id, index, ref->id);
} else {
err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id);
- if (err < 0)
- return err;
}
+ if (err < 0)
+ return err;
index++;
}
if (count > 1) {
@@ -1612,7 +1614,7 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg,
if (!elem)
return -ENOMEM;
- tplg_log(tplg, 'D', pos, "manifest: private size %d", size);
+ tplg_log(tplg, 'D', pos, "manifest: private size %zd", size);
return tplg_add_data(tplg, elem, bin, size);
}
@@ -1672,7 +1674,7 @@ static int tplg_verify_tuple_set(snd_tplg_t *tplg, size_t pos,
va = bin;
if (size < sizeof(*va) || size < va->size) {
- tplg_log(tplg, 'A', pos, "tuple set verify: wrong size %d", size);
+ tplg_log(tplg, 'A', pos, "tuple set verify: wrong size %zd", size);
return -EINVAL;
}
@@ -1719,7 +1721,7 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
va = bin;
if (size < sizeof(*va) || size < va->size) {
- SNDERR("tuples: wrong size %d", size);
+ SNDERR("tuples: wrong size %zd", size);
return -EINVAL;
}
@@ -1806,14 +1808,14 @@ static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos,
int err;
if (size < sizeof(*va)) {
- tplg_log(tplg, 'A', pos, "tuples: small size %d", size);
+ tplg_log(tplg, 'A', pos, "tuples: small size %zd", size);
return -EINVAL;
}
next:
va = bin;
if (size < sizeof(*va)) {
- tplg_log(tplg, 'A', pos, "tuples: unexpected vendor arry size %d", size);
+ tplg_log(tplg, 'A', pos, "tuples: unexpected vendor arry size %zd", size);
return -EINVAL;
}
@@ -1842,14 +1844,14 @@ static int tplg_decode_tuples(snd_tplg_t *tplg,
int err;
if (size < sizeof(*va)) {
- SNDERR("tuples: small size %d", size);
+ SNDERR("tuples: small size %zd", size);
return -EINVAL;
}
next:
va = bin;
if (size < sizeof(*va)) {
- SNDERR("tuples: unexpected vendor arry size %d", size);
+ SNDERR("tuples: unexpected vendor arry size %zd", size);
return -EINVAL;
}
@@ -1894,7 +1896,7 @@ int tplg_add_data(snd_tplg_t *tplg,
next:
tp = bin;
if (off + size < tp->size) {
- SNDERR("data: unexpected element size %d", size);
+ SNDERR("data: unexpected element size %zd", size);
return -EINVAL;
}