topology: straight printf and error path fixes

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-10-19 11:17:21 +02:00
parent 5c1cb568ec
commit e91b1c0670
3 changed files with 15 additions and 13 deletions

View file

@ -879,9 +879,9 @@ int tplg_save_control_mixer(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
if (err >= 0 && mc->max > 0) if (err >= 0 && mc->max > 0)
err = tplg_save_printf(dst, pfx, "\tmax %u\n", mc->max); err = tplg_save_printf(dst, pfx, "\tmax %u\n", mc->max);
if (err >= 0 && mc->invert > 0) 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) 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) if (err >= 0)
err = tplg_save_ops(tplg, &mc->hdr, dst, pfx2); err = tplg_save_ops(tplg, &mc->hdr, dst, pfx2);
if (err >= 0) if (err >= 0)

View file

@ -483,7 +483,7 @@ int tplg_save_dapm_graph(snd_tplg_t *tplg, int index,
} }
if (first) { if (first) {
first = 0; 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) if (err < 0)
return err; return err;
} }

View file

@ -930,6 +930,8 @@ static int tplg_save_tuple_set(struct tplg_vendor_tuples *tuples,
err = tplg_save_printf(dst, pfx, "\t'%s' ", err = tplg_save_printf(dst, pfx, "\t'%s' ",
tuple->token); tuple->token);
} }
if (err < 0)
return err;
switch (set->type) { switch (set->type) {
case SND_SOC_TPLG_TUPLE_TYPE_UUID: case SND_SOC_TPLG_TUPLE_TYPE_UUID:
err = tplg_save_printf(dst, NULL, "'" UUID_FORMAT "'\n", 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); elem->id, index, ref->id);
} else { } else {
err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id); err = tplg_save_printf(dst, pfx, "\t'%s'\n", ref->id);
if (err < 0)
return err;
} }
if (err < 0)
return err;
index++; index++;
} }
if (count > 1) { if (count > 1) {
@ -1612,7 +1614,7 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg,
if (!elem) if (!elem)
return -ENOMEM; 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); 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; va = bin;
if (size < sizeof(*va) || size < va->size) { 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; return -EINVAL;
} }
@ -1719,7 +1721,7 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
va = bin; va = bin;
if (size < sizeof(*va) || size < va->size) { if (size < sizeof(*va) || size < va->size) {
SNDERR("tuples: wrong size %d", size); SNDERR("tuples: wrong size %zd", size);
return -EINVAL; return -EINVAL;
} }
@ -1806,14 +1808,14 @@ static int tplg_verify_tuples(snd_tplg_t *tplg, size_t pos,
int err; int err;
if (size < sizeof(*va)) { 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; return -EINVAL;
} }
next: next:
va = bin; va = bin;
if (size < sizeof(*va)) { 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; return -EINVAL;
} }
@ -1842,14 +1844,14 @@ static int tplg_decode_tuples(snd_tplg_t *tplg,
int err; int err;
if (size < sizeof(*va)) { if (size < sizeof(*va)) {
SNDERR("tuples: small size %d", size); SNDERR("tuples: small size %zd", size);
return -EINVAL; return -EINVAL;
} }
next: next:
va = bin; va = bin;
if (size < sizeof(*va)) { if (size < sizeof(*va)) {
SNDERR("tuples: unexpected vendor arry size %d", size); SNDERR("tuples: unexpected vendor arry size %zd", size);
return -EINVAL; return -EINVAL;
} }
@ -1894,7 +1896,7 @@ int tplg_add_data(snd_tplg_t *tplg,
next: next:
tp = bin; tp = bin;
if (off + size < tp->size) { if (off + size < tp->size) {
SNDERR("data: unexpected element size %d", size); SNDERR("data: unexpected element size %zd", size);
return -EINVAL; return -EINVAL;
} }