replace SNDMSG,SYSMSG,SNDERR,SYSERR with new log macros

... with interface identifiers

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-06 15:57:13 +01:00
parent 492df4bb94
commit 62c8e635dc
82 changed files with 1292 additions and 1201 deletions

View file

@ -50,11 +50,15 @@ static ssize_t write_block_header(snd_tplg_t *tplg, unsigned int type,
/* make sure file offset is aligned with the calculated HDR offset */
if (tplg->bin_pos != tplg->next_hdr_pos) {
SNDERR("New header is at offset 0x%zx but file"
" offset 0x%zx is %s by %ld bytes",
tplg->next_hdr_pos, tplg->bin_pos,
tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind",
tplg->bin_pos - tplg->next_hdr_pos);
snd_error(TOPOLOGY, "New header is at offset 0x%zx but file"
" offset 0x%zx is %s by %ld bytes",
tplg->next_hdr_pos, tplg->bin_pos,
tplg->bin_pos > tplg->next_hdr_pos ? "ahead" : "behind",
tplg->bin_pos - tplg->next_hdr_pos);
return -EINVAL;
}
@ -95,8 +99,9 @@ static int write_elem_block(snd_tplg_t *tplg,
ret = write_block_header(tplg, tplg_type, elem->vendor_type,
tplg->version, elem->index, block_size, count);
if (ret < 0) {
SNDERR("failed to write %s block %d",
obj_name, ret);
snd_error(TOPOLOGY, "failed to write %s block %d",
obj_name, ret);
return ret;
}
@ -137,8 +142,9 @@ static int write_elem_block(snd_tplg_t *tplg,
/* make sure we have written the correct size */
if (total_size != size) {
SNDERR("size mismatch. Expected %zu wrote %zu",
size, total_size);
snd_error(TOPOLOGY, "size mismatch. Expected %zu wrote %zu",
size, total_size);
return -EIO;
}
@ -210,7 +216,7 @@ static ssize_t write_manifest_data(snd_tplg_t *tplg)
tplg->version, 0,
sizeof(tplg->manifest) + tplg->manifest.priv.size, 1);
if (ret < 0) {
SNDERR("failed to write manifest block");
snd_error(TOPOLOGY, "failed to write manifest block");
return ret;
}
@ -258,7 +264,7 @@ int tplg_write_data(snd_tplg_t *tplg)
/* write manifest */
ret = write_manifest_data(tplg);
if (ret < 0) {
SNDERR("failed to write manifest %d", ret);
snd_error(TOPOLOGY, "failed to write manifest %d", ret);
return ret;
}
@ -279,8 +285,9 @@ int tplg_write_data(snd_tplg_t *tplg)
ret = write_elem_block(tplg, list, size,
tptr->tsoc, tptr->name);
if (ret < 0) {
SNDERR("failed to write %s elements: %s",
tptr->name, snd_strerror(-ret));
snd_error(TOPOLOGY, "failed to write %s elements: %s",
tptr->name, snd_strerror(-ret));
return ret;
}
}
@ -289,8 +296,9 @@ int tplg_write_data(snd_tplg_t *tplg)
tplg->bin_pos, tplg->bin_pos);
if (total_size != tplg->bin_pos) {
SNDERR("total size mismatch (%zd != %zd)",
total_size, tplg->bin_pos);
snd_error(TOPOLOGY, "total size mismatch (%zd != %zd)",
total_size, tplg->bin_pos);
return -EINVAL;
}

View file

@ -103,7 +103,7 @@ int tplg_parse_channel(snd_tplg_t *tplg, snd_config_t *cfg,
channel_id = lookup_channel(id);
if (channel_id < 0) {
SNDERR("invalid channel %s", id);
snd_error(TOPOLOGY, "invalid channel %s", id);
return -EINVAL;
}

View file

@ -94,7 +94,7 @@ int parse_access(snd_config_t *cfg,
if (strcmp(id, "access") == 0) {
err = parse_access_values(n, hdr);
if (err < 0) {
SNDERR("failed to parse access");
snd_error(TOPOLOGY, "failed to parse access");
return err;
}
continue;
@ -187,8 +187,9 @@ static int tplg_build_mixer_control(snd_tplg_t *tplg,
}
if (!ref->elem) {
SNDERR("cannot find '%s' referenced by"
" control '%s'", ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find '%s' referenced by"
" control '%s'", ref->id, elem->id);
return -EINVAL;
} else if (err < 0)
return err;
@ -236,8 +237,9 @@ static int tplg_build_enum_control(snd_tplg_t *tplg,
return err;
}
if (!ref->elem) {
SNDERR("cannot find '%s' referenced by"
" control '%s'", ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find '%s' referenced by"
" control '%s'", ref->id, elem->id);
return -EINVAL;
}
}
@ -358,7 +360,7 @@ static int tplg_parse_tlv_dbscale(snd_config_t *cfg, struct tplg_elem *elem)
else if (strcmp(id, "mute") == 0)
scale->mute = val;
else
SNDERR("unknown id '%s'", id);
snd_error(TOPOLOGY, "unknown id '%s'", id);
}
return 0;
@ -387,7 +389,7 @@ int tplg_parse_tlv(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "scale") == 0) {
err = tplg_parse_tlv_dbscale(n, elem);
if (err < 0) {
SNDERR("failed to DBScale");
snd_error(TOPOLOGY, "failed to DBScale");
return err;
}
continue;
@ -407,7 +409,7 @@ int tplg_save_tlv(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
int err;
if (tlv->type != SNDRV_CTL_TLVT_DB_SCALE) {
SNDERR("unknown TLV type");
snd_error(TOPOLOGY, "unknown TLV type");
return -EINVAL;
}
@ -650,7 +652,7 @@ int tplg_parse_control_enum(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "channel") == 0) {
if (ec->num_channels >= SND_SOC_TPLG_MAX_CHAN) {
SNDERR("too many channels %s", elem->id);
snd_error(TOPOLOGY, "too many channels %s", elem->id);
return -EINVAL;
}
@ -778,7 +780,7 @@ int tplg_parse_control_mixer(snd_tplg_t *tplg,
if (strcmp(id, "channel") == 0) {
if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) {
SNDERR("too many channels %s", elem->id);
snd_error(TOPOLOGY, "too many channels %s", elem->id);
return -EINVAL;
}
@ -936,7 +938,7 @@ static int init_ctl_hdr(snd_tplg_t *tplg,
struct snd_soc_tplg_tlv_dbscale *scale;
if (!tlvt) {
SNDERR("missing TLV data");
snd_error(TOPOLOGY, "missing TLV data");
return -EINVAL;
}
@ -966,7 +968,7 @@ static int init_ctl_hdr(snd_tplg_t *tplg,
/* TODO: add support for other TLV types */
default:
SNDERR("unsupported TLV type %d", tlv->type);
snd_error(TOPOLOGY, "unsupported TLV type %d", tlv->type);
break;
}
}
@ -985,7 +987,7 @@ int tplg_add_mixer(snd_tplg_t *tplg, struct snd_tplg_mixer_template *mixer,
tplg_dbg(" Control Mixer: %s", mixer->hdr.name);
if (mixer->hdr.type != SND_SOC_TPLG_TYPE_MIXER) {
SNDERR("invalid mixer type %d", mixer->hdr.type);
snd_error(TOPOLOGY, "invalid mixer type %d", mixer->hdr.type);
return -EINVAL;
}
@ -1049,7 +1051,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
tplg_dbg(" Control Enum: %s", enum_ctl->hdr.name);
if (enum_ctl->hdr.type != SND_SOC_TPLG_TYPE_ENUM) {
SNDERR("invalid enum type %d", enum_ctl->hdr.type);
snd_error(TOPOLOGY, "invalid enum type %d", enum_ctl->hdr.type);
return -EINVAL;
}
@ -1140,7 +1142,7 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
tplg_dbg(" Control Bytes: %s", bytes_ctl->hdr.name);
if (bytes_ctl->hdr.type != SND_SOC_TPLG_TYPE_BYTES) {
SNDERR("invalid bytes type %d", bytes_ctl->hdr.type);
snd_error(TOPOLOGY, "invalid bytes type %d", bytes_ctl->hdr.type);
return -EINVAL;
}
@ -1177,8 +1179,9 @@ int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
if (be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) {
if ((be->hdr.access & SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE)
!= SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE) {
SNDERR("Invalid TLV bytes control access 0x%x",
be->hdr.access);
snd_error(TOPOLOGY, "Invalid TLV bytes control access 0x%x",
be->hdr.access);
tplg_elem_free(elem);
return -EINVAL;
}
@ -1221,14 +1224,14 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
int i;
if (size < sizeof(*mc)) {
SNDERR("mixer: small size %d", size);
snd_error(TOPOLOGY, "mixer: small size %d", size);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "mixer: size %d TLV size %d private size %d",
mc->size, mc->hdr.tlv.size, mc->priv.size);
if (size != mc->size + mc->priv.size) {
SNDERR("mixer: unexpected element size %d", size);
snd_error(TOPOLOGY, "mixer: unexpected element size %d", size);
return -EINVAL;
}
@ -1258,8 +1261,9 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
/* nothing */
} else if (mc->hdr.tlv.size == sizeof(struct snd_soc_tplg_ctl_tlv)) {
if (mc->hdr.tlv.type != SNDRV_CTL_TLVT_DB_SCALE) {
SNDERR("mixer: unknown TLV type %d",
mc->hdr.tlv.type);
snd_error(TOPOLOGY, "mixer: unknown TLV type %d",
mc->hdr.tlv.type);
return -EINVAL;
}
db = tplg_calloc(heap, sizeof(*db));
@ -1273,7 +1277,7 @@ int tplg_decode_control_mixer1(snd_tplg_t *tplg,
tplg_log(tplg, 'D', pos, "mixer: dB scale TLV: min %d step %d mute %d",
db->min, db->step, db->mute);
} else {
SNDERR("mixer: wrong TLV size %d", mc->hdr.tlv.size);
snd_error(TOPOLOGY, "mixer: wrong TLV size %d", mc->hdr.tlv.size);
return -EINVAL;
}
@ -1301,15 +1305,16 @@ int tplg_decode_control_mixer(snd_tplg_t *tplg,
next:
if (size < sizeof(*mc)) {
SNDERR("mixer: small size %d", size);
snd_error(TOPOLOGY, "mixer: small size %d", size);
return -EINVAL;
}
INIT_LIST_HEAD(&heap);
mc = bin;
size2 = mc->size + mc->priv.size;
if (size2 > size) {
SNDERR("mixer: wrong element size (%d, priv %d)",
mc->size, mc->priv.size);
snd_error(TOPOLOGY, "mixer: wrong element size (%d, priv %d)",
mc->size, mc->priv.size);
return -EINVAL;
}
@ -1342,11 +1347,11 @@ int tplg_decode_control_enum1(snd_tplg_t *tplg,
if (ec->num_channels > SND_TPLG_MAX_CHAN ||
ec->num_channels > SND_SOC_TPLG_MAX_CHAN) {
SNDERR("enum: unexpected channel count %d", ec->num_channels);
snd_error(TOPOLOGY, "enum: unexpected channel count %d", ec->num_channels);
return -EINVAL;
}
if (ec->items > SND_SOC_TPLG_NUM_TEXTS) {
SNDERR("enum: unexpected texts count %d", ec->items);
snd_error(TOPOLOGY, "enum: unexpected texts count %d", ec->items);
return -EINVAL;
}
@ -1404,15 +1409,16 @@ int tplg_decode_control_enum(snd_tplg_t *tplg,
next:
if (size < sizeof(*ec)) {
SNDERR("enum: small size %d", size);
snd_error(TOPOLOGY, "enum: small size %d", size);
return -EINVAL;
}
INIT_LIST_HEAD(&heap);
ec = bin;
size2 = ec->size + ec->priv.size;
if (size2 > size) {
SNDERR("enum: wrong element size (%d, priv %d)",
ec->size, ec->priv.size);
snd_error(TOPOLOGY, "enum: wrong element size (%d, priv %d)",
ec->size, ec->priv.size);
return -EINVAL;
}
@ -1446,14 +1452,14 @@ int tplg_decode_control_bytes1(snd_tplg_t *tplg,
struct snd_soc_tplg_bytes_control *bc = bin;
if (size < sizeof(*bc)) {
SNDERR("bytes: small size %d", size);
snd_error(TOPOLOGY, "bytes: small size %d", size);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "control bytes: size %d private size %d",
bc->size, bc->priv.size);
if (size != bc->size + bc->priv.size) {
SNDERR("bytes: unexpected element size %d", size);
snd_error(TOPOLOGY, "bytes: unexpected element size %d", size);
return -EINVAL;
}
@ -1495,14 +1501,15 @@ int tplg_decode_control_bytes(snd_tplg_t *tplg,
next:
if (size < sizeof(*bc)) {
SNDERR("bytes: small size %d", size);
snd_error(TOPOLOGY, "bytes: small size %d", size);
return -EINVAL;
}
bc = bin;
size2 = bc->size + bc->priv.size;
if (size2 > size) {
SNDERR("bytes: wrong element size (%d, priv %d)",
bc->size, bc->priv.size);
snd_error(TOPOLOGY, "bytes: wrong element size (%d, priv %d)",
bc->size, bc->priv.size);
return -EINVAL;
}

View file

@ -154,8 +154,9 @@ static int tplg_build_widget(snd_tplg_t *tplg, struct tplg_elem *elem)
}
if (!ref->elem) {
SNDERR("cannot find '%s' referenced by widget '%s'",
ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find '%s' referenced by widget '%s'",
ref->id, elem->id);
return -EINVAL;
}
@ -178,7 +179,7 @@ int tplg_build_widgets(snd_tplg_t *tplg)
elem = list_entry(pos, struct tplg_elem, list);
if (!elem->widget || elem->type != SND_TPLG_TYPE_DAPM_WIDGET) {
SNDERR("invalid widget '%s'", elem->id);
snd_error(TOPOLOGY, "invalid widget '%s'", elem->id);
return -EINVAL;
}
@ -205,7 +206,7 @@ int tplg_build_routes(snd_tplg_t *tplg)
elem = list_entry(pos, struct tplg_elem, list);
if (!elem->route || elem->type != SND_TPLG_TYPE_DAPM_GRAPH) {
SNDERR("invalid route '%s'", elem->id);
snd_error(TOPOLOGY, "invalid route '%s'", elem->id);
return -EINVAL;
}
@ -215,13 +216,13 @@ int tplg_build_routes(snd_tplg_t *tplg)
/* validate sink */
if (strlen(route->sink) <= 0) {
SNDERR("no sink");
snd_error(TOPOLOGY, "no sink");
return -EINVAL;
}
if (!tplg_elem_lookup(&tplg->widget_list, route->sink,
SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) {
SNDERR("undefined sink widget/stream '%s'", route->sink);
snd_error(TOPOLOGY, "undefined sink widget/stream '%s'", route->sink);
}
/* validate control name */
@ -230,21 +231,23 @@ int tplg_build_routes(snd_tplg_t *tplg)
SND_TPLG_TYPE_MIXER, elem->index) &&
!tplg_elem_lookup(&tplg->enum_list, route->control,
SND_TPLG_TYPE_ENUM, elem->index)) {
SNDERR("undefined mixer/enum control '%s'",
route->control);
snd_error(TOPOLOGY, "undefined mixer/enum control '%s'",
route->control);
}
}
/* validate source */
if (strlen(route->source) <= 0) {
SNDERR("no source");
snd_error(TOPOLOGY, "no source");
return -EINVAL;
}
if (!tplg_elem_lookup(&tplg->widget_list, route->source,
SND_TPLG_TYPE_DAPM_WIDGET, SND_TPLG_INDEX_ALL)) {
SNDERR("undefined source widget/stream '%s'",
route->source);
snd_error(TOPOLOGY, "undefined source widget/stream '%s'",
route->source);
}
/* add graph to manifest */
@ -296,7 +299,7 @@ static int tplg_parse_line(const char *text,
len = strlen(buf);
if (len <= 2) {
SNDERR("invalid route \"%s\"", buf);
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
}
@ -305,7 +308,7 @@ static int tplg_parse_line(const char *text,
if (buf[i] == ',')
goto second;
}
SNDERR("invalid route \"%s\"", buf);
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
second:
@ -319,7 +322,7 @@ second:
goto done;
}
SNDERR("invalid route \"%s\"", buf);
snd_error(TOPOLOGY, "invalid route \"%s\"", buf);
return -EINVAL;
done:
@ -374,7 +377,7 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
int index = -1;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound is expected for dapm graph definition");
snd_error(TOPOLOGY, "compound is expected for dapm graph definition");
return -EINVAL;
}
@ -397,14 +400,16 @@ int tplg_parse_dapm_graph(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "lines") == 0) {
if (index < 0) {
SNDERR("failed to parse dapm graph %s, missing index",
graph_id);
snd_error(TOPOLOGY, "failed to parse dapm graph %s, missing index",
graph_id);
return -EINVAL;
}
err = tplg_parse_routes(tplg, n, index);
if (err < 0) {
SNDERR("failed to parse dapm graph %s",
graph_id);
snd_error(TOPOLOGY, "failed to parse dapm graph %s",
graph_id);
return err;
}
continue;
@ -545,8 +550,9 @@ int tplg_parse_dapm_widget(snd_tplg_t *tplg,
widget_type = lookup_widget(val);
if (widget_type < 0){
SNDERR("widget '%s': Unsupported widget type %s",
elem->id, val);
snd_error(TOPOLOGY, "widget '%s': Unsupported widget type %s",
elem->id, val);
return -EINVAL;
}
@ -847,8 +853,9 @@ int tplg_add_widget_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
break;
default:
SNDERR("widget %s: invalid type %d for ctl %d",
wt->name, ct->type, i);
snd_error(TOPOLOGY, "widget %s: invalid type %d for ctl %d",
wt->name, ct->type, i);
ret = -EINVAL;
break;
}
@ -898,17 +905,19 @@ next:
w = bin;
if (size < sizeof(*w)) {
SNDERR("dapm widget: small size %d", size);
snd_error(TOPOLOGY, "dapm widget: small size %d", size);
return -EINVAL;
}
if (sizeof(*w) != w->size) {
SNDERR("dapm widget: unknown element size %d (expected %zd)",
w->size, sizeof(*w));
snd_error(TOPOLOGY, "dapm widget: unknown element size %d (expected %zd)",
w->size, sizeof(*w));
return -EINVAL;
}
if (w->num_kcontrols > 16) {
SNDERR("dapm widget: too many kcontrols %d",
w->num_kcontrols);
snd_error(TOPOLOGY, "dapm widget: too many kcontrols %d",
w->num_kcontrols);
return -EINVAL;
}
@ -934,8 +943,9 @@ next:
wt->name, wt->sname);
if (sizeof(*w) + w->priv.size > size) {
SNDERR("dapm widget: wrong private data size %d",
w->priv.size);
snd_error(TOPOLOGY, "dapm widget: wrong private data size %d",
w->priv.size);
return -EINVAL;
}
@ -962,8 +972,9 @@ next:
size2 = mc->size + mc->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol mixer size %zd", size2);
if (size2 > size) {
SNDERR("dapm widget: small mixer size %d",
size2);
snd_error(TOPOLOGY, "dapm widget: small mixer size %d",
size2);
err = -EINVAL;
goto retval;
}
@ -982,8 +993,9 @@ next:
size2 = ec->size + ec->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol enum size %zd", size2);
if (size2 > size) {
SNDERR("dapm widget: small enum size %d",
size2);
snd_error(TOPOLOGY, "dapm widget: small enum size %d",
size2);
err = -EINVAL;
goto retval;
}
@ -1001,8 +1013,9 @@ next:
size2 = bc->size + bc->priv.size;
tplg_log(tplg, 'D', pos, "kcontrol bytes size %zd", size2);
if (size2 > size) {
SNDERR("dapm widget: small bytes size %d",
size2);
snd_error(TOPOLOGY, "dapm widget: small bytes size %d",
size2);
err = -EINVAL;
goto retval;
}
@ -1010,8 +1023,9 @@ next:
bin, size2);
break;
default:
SNDERR("dapm widget: wrong control type %d",
chdr->type);
snd_error(TOPOLOGY, "dapm widget: wrong control type %d",
chdr->type);
err = -EINVAL;
goto retval;
}
@ -1059,7 +1073,7 @@ int tplg_decode_dapm_graph(snd_tplg_t *tplg,
for (ge = gt->elem; size > 0; ge++) {
g = bin;
if (size < sizeof(*g)) {
SNDERR("dapm graph: small size %d", size);
snd_error(TOPOLOGY, "dapm graph: small size %d", size);
return -EINVAL;
}
ge->src = g->source;

View file

@ -60,8 +60,9 @@ struct snd_soc_tplg_private *get_priv_data(struct tplg_elem *elem)
priv = &elem->pcm->priv;
break;
default:
SNDERR("'%s': no support for private data for type %d",
elem->id, elem->type);
snd_error(TOPOLOGY, "'%s': no support for private data for type %d",
elem->id, elem->type);
}
return priv;
@ -94,7 +95,7 @@ int tplg_parse_refs(snd_config_t *cfg, struct tplg_elem *elem,
}
if (cfg_type != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound type expected for %s", elem->id);
snd_error(TOPOLOGY, "compound type expected for %s", elem->id);
return -EINVAL;
}
@ -183,7 +184,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
fp = fopen(filename, "r");
if (fp == NULL) {
SNDERR("invalid data file path '%s'", filename);
snd_error(TOPOLOGY, "invalid data file path '%s'", filename);
return -errno;
}
@ -191,12 +192,12 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
size = ftell(fp);
fseek(fp, 0L, SEEK_SET);
if (size <= 0) {
SNDERR("invalid data file size %zu", size);
snd_error(TOPOLOGY, "invalid data file size %zu", size);
ret = -EINVAL;
goto err;
}
if (size > TPLG_MAX_PRIV_SIZE) {
SNDERR("data file too big %zu", size);
snd_error(TOPOLOGY, "data file too big %zu", size);
ret = -EINVAL;
goto err;
}
@ -218,7 +219,7 @@ static int tplg_parse_data_file(snd_config_t *cfg, struct tplg_elem *elem)
elem->size = sizeof(*priv) + size;
if (fclose(fp) == EOF) {
SNDERR("Cannot close data file.");
snd_error(TOPOLOGY, "Cannot close data file.");
return -errno;
}
return 0;
@ -359,7 +360,7 @@ static int get_uuid(const char *str, unsigned char *uuid_le)
if ((errno == ERANGE && val == ULONG_MAX)
|| (errno != 0 && val == 0)
|| (val > UCHAR_MAX)) {
SNDERR("invalid value for uuid");
snd_error(TOPOLOGY, "invalid value for uuid");
ret = -EINVAL;
goto out;
}
@ -383,7 +384,7 @@ data2:
if ((errno == ERANGE && val == ULONG_MAX)
|| (errno != 0 && val == 0)
|| (val > UCHAR_MAX)) {
SNDERR("invalid value for uuid");
snd_error(TOPOLOGY, "invalid value for uuid");
ret = -EINVAL;
goto out;
}
@ -398,7 +399,7 @@ data2:
}
if (values < 16) {
SNDERR("less than 16 integers for uuid");
snd_error(TOPOLOGY, "less than 16 integers for uuid");
ret = -EINVAL;
}
@ -475,7 +476,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem,
num = get_hex_num(value);
if (num <= 0) {
SNDERR("malformed hex variable list %s", value);
snd_error(TOPOLOGY, "malformed hex variable list %s", value);
return -EINVAL;
}
@ -483,7 +484,7 @@ static int tplg_parse_data_hex(snd_config_t *cfg, struct tplg_elem *elem,
priv = elem->data;
if (size > TPLG_MAX_PRIV_SIZE) {
SNDERR("data too big %d", size);
snd_error(TOPOLOGY, "data too big %d", size);
return -EINVAL;
}
@ -521,7 +522,7 @@ static int get_token_value(const char *token_id,
return tokens->token[i].value;
}
SNDERR("cannot find token id '%s'", token_id);
snd_error(TOPOLOGY, "cannot find token id '%s'", token_id);
return -1;
}
@ -609,7 +610,7 @@ static int copy_tuples(struct tplg_elem *elem,
* tuple_set->num_tuples;
size += set_size;
if (size > TPLG_MAX_PRIV_SIZE) {
SNDERR("data too big %d", size);
snd_error(TOPOLOGY, "data too big %d", size);
return -EINVAL;
}
@ -693,13 +694,13 @@ static int build_tuples(snd_tplg_t *tplg, struct tplg_elem *elem)
ref->id, SND_TPLG_TYPE_TUPLE, elem->index);
tuples = ref->elem;
if (!tuples) {
SNDERR("cannot find tuples %s", ref->id);
snd_error(TOPOLOGY, "cannot find tuples %s", ref->id);
return -EINVAL;
}
tokens = get_tokens(tplg, tuples);
if (!tokens) {
SNDERR("cannot find token for %s", ref->id);
snd_error(TOPOLOGY, "cannot find token for %s", ref->id);
return -EINVAL;
}
@ -795,7 +796,7 @@ static int parse_tuple_set(snd_config_t *cfg,
type = get_tuple_type(id);
if (type < 0) {
SNDERR("invalid tuple type '%s'", id);
snd_error(TOPOLOGY, "invalid tuple type '%s'", id);
return type;
}
@ -852,7 +853,7 @@ static int parse_tuple_set(snd_config_t *cfg,
case SND_SOC_TPLG_TUPLE_TYPE_WORD:
ival = tplg_get_unsigned(n, &tuple_val, 0);
if (ival < 0) {
SNDERR("tuple %s: %s", id, snd_strerror(ival));
snd_error(TOPOLOGY, "tuple %s: %s", id, snd_strerror(ival));
goto err;
}
@ -862,7 +863,7 @@ static int parse_tuple_set(snd_config_t *cfg,
&& tuple_val > USHRT_MAX) ||
(type == SND_SOC_TPLG_TUPLE_TYPE_BYTE
&& tuple_val > UCHAR_MAX)) {
SNDERR("tuple %s: invalid value", id);
snd_error(TOPOLOGY, "tuple %s: invalid value", id);
goto err;
}
@ -976,7 +977,7 @@ static int parse_tuple_sets(snd_config_t *cfg,
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
if (snd_config_get_id(cfg, &id) >= 0)
SNDERR("compound type expected for %s", id);
snd_error(TOPOLOGY, "compound type expected for %s", id);
return -EINVAL;
}
@ -994,8 +995,9 @@ static int parse_tuple_sets(snd_config_t *cfg,
snd_config_for_each(i, next, cfg) {
n = snd_config_iterator_entry(i);
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound type expected for %s, is %d",
id, snd_config_get_type(n));
snd_error(TOPOLOGY, "compound type expected for %s, is %d",
id, snd_config_get_type(n));
return -EINVAL;
}
@ -1204,7 +1206,7 @@ int tplg_parse_manifest_data(snd_tplg_t *tplg, snd_config_t *cfg,
int err;
if (!list_empty(&tplg->manifest_list)) {
SNDERR("already has manifest data");
snd_error(TOPOLOGY, "already has manifest data");
return -EINVAL;
}
@ -1364,7 +1366,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "file") == 0) {
err = tplg_parse_data_file(n, elem);
if (err < 0) {
SNDERR("failed to parse data file");
snd_error(TOPOLOGY, "failed to parse data file");
return err;
}
continue;
@ -1373,7 +1375,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "bytes") == 0) {
err = tplg_parse_data_hex(n, elem, 1);
if (err < 0) {
SNDERR("failed to parse data bytes");
snd_error(TOPOLOGY, "failed to parse data bytes");
return err;
}
continue;
@ -1382,7 +1384,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "shorts") == 0) {
err = tplg_parse_data_hex(n, elem, 2);
if (err < 0) {
SNDERR("failed to parse data shorts");
snd_error(TOPOLOGY, "failed to parse data shorts");
return err;
}
continue;
@ -1391,7 +1393,7 @@ int tplg_parse_data(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "words") == 0) {
err = tplg_parse_data_hex(n, elem, 4);
if (err < 0) {
SNDERR("failed to parse data words");
snd_error(TOPOLOGY, "failed to parse data words");
return err;
}
continue;
@ -1508,8 +1510,9 @@ int tplg_copy_data(snd_tplg_t *tplg, struct tplg_elem *elem,
ref_elem = tplg_elem_lookup(&tplg->pdata_list,
ref->id, SND_TPLG_TYPE_DATA, elem->index);
if (!ref_elem) {
SNDERR("cannot find data '%s' referenced by"
" element '%s'", ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find data '%s' referenced by"
" element '%s'", ref->id, elem->id);
return -EINVAL;
}
@ -1579,24 +1582,25 @@ int tplg_decode_manifest_data(snd_tplg_t *tplg,
size_t off;
if (hdr->index != 0) {
SNDERR("manifest - wrong index %d", hdr->index);
snd_error(TOPOLOGY, "manifest - wrong index %d", hdr->index);
return -EINVAL;
}
if (sizeof(*m) > size) {
SNDERR("manifest - wrong size %zd (minimal %zd)",
size, sizeof(*m));
snd_error(TOPOLOGY, "manifest - wrong size %zd (minimal %zd)",
size, sizeof(*m));
return -EINVAL;
}
if (m->size != sizeof(*m)) {
SNDERR("manifest - wrong sructure size %d", m->size);
snd_error(TOPOLOGY, "manifest - wrong sructure size %d", m->size);
return -EINVAL;
}
off = offsetof(struct snd_soc_tplg_manifest, priv);
if (off + m->priv.size > size) {
SNDERR("manifest - wrong private size %d", m->priv.size);
snd_error(TOPOLOGY, "manifest - wrong private size %d", m->priv.size);
return -EINVAL;
}
@ -1718,7 +1722,7 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
va = bin;
if (size < sizeof(*va) || size < va->size) {
SNDERR("tuples: wrong size %zd", size);
snd_error(TOPOLOGY, "tuples: wrong size %zd", size);
return -EINVAL;
}
@ -1731,20 +1735,21 @@ static int tplg_decode_tuple_set(snd_tplg_t *tplg,
case SND_SOC_TPLG_TUPLE_TYPE_SHORT:
break;
default:
SNDERR("tuples: unknown array type %d", va->type);
snd_error(TOPOLOGY, "tuples: unknown array type %d", va->type);
return -EINVAL;
}
j = tplg_get_tuple_size(va->type) * va->num_elems;
if (j + sizeof(*va) != va->size) {
SNDERR("tuples: wrong vendor array size %d "
"(expected %d for %d count %d)",
snd_error(TOPOLOGY, "tuples: wrong vendor array size %d "
"(expected %d for %d count %d)",
va->size, j + sizeof(*va), va->type, va->num_elems);
return -EINVAL;
}
if (va->num_elems > 4096) {
SNDERR("tuples: tuples overflow %d", va->num_elems);
snd_error(TOPOLOGY, "tuples: tuples overflow %d", va->num_elems);
return -EINVAL;
}
@ -1841,19 +1846,19 @@ static int tplg_decode_tuples(snd_tplg_t *tplg,
int err;
if (size < sizeof(*va)) {
SNDERR("tuples: small size %zd", size);
snd_error(TOPOLOGY, "tuples: small size %zd", size);
return -EINVAL;
}
next:
va = bin;
if (size < sizeof(*va)) {
SNDERR("tuples: unexpected vendor arry size %zd", size);
snd_error(TOPOLOGY, "tuples: unexpected vendor arry size %zd", size);
return -EINVAL;
}
if (tuples->num_sets >= tuples->alloc_sets) {
SNDERR("tuples: index overflow (%d)", tuples->num_sets);
snd_error(TOPOLOGY, "tuples: index overflow (%d)", tuples->num_sets);
return -EINVAL;
}
@ -1893,7 +1898,7 @@ int tplg_add_data(snd_tplg_t *tplg,
next:
tp = bin;
if (off + size < tp->size) {
SNDERR("data: unexpected element size %zd", size);
snd_error(TOPOLOGY, "data: unexpected element size %zd", size);
return -EINVAL;
}
@ -1997,6 +2002,6 @@ int tplg_decode_data(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
SNDERR("data type not expected");
snd_error(TOPOLOGY, "data type not expected");
return -EINVAL;
}

View file

@ -61,40 +61,40 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags)
}
if (size - pos < sizeof(*hdr)) {
tplg_log(tplg, 'D', pos, "block: small size");
SNDERR("incomplete header data to decode");
snd_error(TOPOLOGY, "incomplete header data to decode");
return -EINVAL;
}
hdr = b;
if (hdr->magic != SND_SOC_TPLG_MAGIC) {
SNDERR("bad block magic %08x", hdr->magic);
snd_error(TOPOLOGY, "bad block magic %08x", hdr->magic);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "block: abi %d size %d payload size %d",
hdr->abi, hdr->size, hdr->payload_size);
if (hdr->abi != SND_SOC_TPLG_ABI_VERSION) {
SNDERR("unsupported ABI version %d", hdr->abi);
snd_error(TOPOLOGY, "unsupported ABI version %d", hdr->abi);
return -EINVAL;
}
if (hdr->size != sizeof(*hdr)) {
SNDERR("header size mismatch");
snd_error(TOPOLOGY, "header size mismatch");
return -EINVAL;
}
if (size - pos < hdr->size + hdr->payload_size) {
SNDERR("incomplete payload data to decode");
snd_error(TOPOLOGY, "incomplete payload data to decode");
return -EINVAL;
}
if (hdr->payload_size < 8) {
SNDERR("wrong payload size %d", hdr->payload_size);
snd_error(TOPOLOGY, "wrong payload size %d", hdr->payload_size);
return -EINVAL;
}
/* first block must be manifest */
if (b == bin) {
if (hdr->type != SND_SOC_TPLG_TYPE_MANIFEST) {
SNDERR("first block must be manifest (value %d)", hdr->type);
snd_error(TOPOLOGY, "first block must be manifest (value %d)", hdr->type);
return -EINVAL;
}
err = snd_tplg_set_version(tplg, hdr->version);
@ -109,7 +109,7 @@ int snd_tplg_decode(snd_tplg_t *tplg, void *bin, size_t size, int dflags)
break;
}
if (index >= tplg_table_items || tptr->decod == NULL) {
SNDERR("unknown block type %d", hdr->type);
snd_error(TOPOLOGY, "unknown block type %d", hdr->type);
return -EINVAL;
}
tplg_log(tplg, 'D', pos, "block: type %d - %s", hdr->type, tptr->name);

View file

@ -237,7 +237,7 @@ int tplg_get_type(int asoc_type)
for (index = 0; index < tplg_table_items; index++)
if (tplg_table[index].tsoc == asoc_type)
return tplg_table[index].type;
SNDERR("uknown asoc type %d", asoc_type);
snd_error(TOPOLOGY, "uknown asoc type %d", asoc_type);
return -EINVAL;
}

View file

@ -44,7 +44,7 @@ static int lookup_ops(const char *c)
/* cant find string name in our table so we use its ID number */
i = safe_strtol(c, &ret);
if (i < 0) {
SNDERR("wrong kcontrol ops value string '%s'", c);
snd_error(TOPOLOGY, "wrong kcontrol ops value string '%s'", c);
return i;
}

View file

@ -120,7 +120,7 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg,
return -EINVAL;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound type expected for %s", id);
snd_error(TOPOLOGY, "compound type expected for %s", id);
return -EINVAL;
}
@ -129,8 +129,9 @@ int tplg_parse_compound(snd_tplg_t *tplg, snd_config_t *cfg,
n = snd_config_iterator_entry(i);
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound type expected for %s, is %d",
id, snd_config_get_type(cfg));
snd_error(TOPOLOGY, "compound type expected for %s, is %d",
id, snd_config_get_type(cfg));
return -EINVAL;
}
@ -153,7 +154,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg)
int err;
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
SNDERR("compound type expected at top level");
snd_error(TOPOLOGY, "compound type expected at top level");
return -EINVAL;
}
@ -178,7 +179,7 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg)
}
if (parser == NULL) {
SNDERR("unknown section %s", id);
snd_error(TOPOLOGY, "unknown section %s", id);
continue;
}
@ -200,7 +201,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in)
ret = snd_config_load(top, in);
if (ret < 0) {
SNDERR("could not load configuration");
snd_error(TOPOLOGY, "could not load configuration");
snd_config_delete(top);
return ret;
}
@ -208,7 +209,7 @@ static int tplg_load_config(snd_tplg_t *tplg, snd_input_t *in)
ret = tplg_parse_config(tplg, top);
snd_config_delete(top);
if (ret < 0) {
SNDERR("failed to parse topology");
snd_error(TOPOLOGY, "failed to parse topology");
return ret;
}
@ -265,7 +266,7 @@ int snd_tplg_load(snd_tplg_t *tplg, const char *buf, size_t size)
err = snd_input_buffer_open(&in, buf, size);
if (err < 0) {
SNDERR("could not create input buffer");
snd_error(TOPOLOGY, "could not create input buffer");
return err;
}
@ -280,13 +281,13 @@ static int tplg_build(snd_tplg_t *tplg)
err = tplg_build_integ(tplg);
if (err < 0) {
SNDERR("failed to check topology integrity");
snd_error(TOPOLOGY, "failed to check topology integrity");
return err;
}
err = tplg_write_data(tplg);
if (err < 0) {
SNDERR("failed to write data %d", err);
snd_error(TOPOLOGY, "failed to write data %d", err);
return err;
}
return 0;
@ -302,14 +303,14 @@ int snd_tplg_build_file(snd_tplg_t *tplg,
fp = fopen(infile, "r");
if (fp == NULL) {
SNDERR("could not open configuration file %s", infile);
snd_error(TOPOLOGY, "could not open configuration file %s", infile);
return -errno;
}
err = snd_input_stdio_attach(&in, fp, 1);
if (err < 0) {
fclose(fp);
SNDERR("could not attach stdio %s", infile);
snd_error(TOPOLOGY, "could not attach stdio %s", infile);
return err;
}
@ -343,7 +344,7 @@ int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
case SND_TPLG_TYPE_CC:
return tplg_add_link_object(tplg, t);
default:
SNDERR("invalid object type %d", t->type);
snd_error(TOPOLOGY, "invalid object type %d", t->type);
return -EINVAL;
};
}
@ -359,18 +360,18 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
fd = open(outfile, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fd < 0) {
SNDERR("failed to open %s err %d", outfile, -errno);
snd_error(TOPOLOGY, "failed to open %s err %d", outfile, -errno);
return -errno;
}
r = write(fd, tplg->bin, tplg->bin_size);
close(fd);
if (r < 0) {
err = -errno;
SNDERR("write error: %s", strerror(errno));
snd_error(TOPOLOGY, "write error: %s", strerror(errno));
return err;
}
if ((size_t)r != tplg->bin_size) {
SNDERR("partial write (%zd != %zd)", r, tplg->bin_size);
snd_error(TOPOLOGY, "partial write (%zd != %zd)", r, tplg->bin_size);
return -EIO;
}
return 0;
@ -436,7 +437,7 @@ snd_tplg_t *snd_tplg_create(int flags)
snd_tplg_t *tplg;
if (!is_little_endian()) {
SNDERR("cannot support big-endian machines");
snd_error(TOPOLOGY, "cannot support big-endian machines");
return NULL;
}

View file

@ -115,8 +115,9 @@ static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem)
return err;
}
if (!ref->elem) {
SNDERR("cannot find '%s' referenced by"
" PCM '%s'", ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find '%s' referenced by"
" PCM '%s'", ref->id, elem->id);
return -EINVAL;
}
}
@ -136,7 +137,7 @@ int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type)
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
SNDERR("invalid elem '%s'", elem->id);
snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
@ -195,7 +196,7 @@ int tplg_build_dais(snd_tplg_t *tplg, unsigned int type)
elem = list_entry(pos, struct tplg_elem, list);
if (elem->type != type) {
SNDERR("invalid elem '%s'", elem->id);
snd_error(TOPOLOGY, "invalid elem '%s'", elem->id);
return -EINVAL;
}
@ -250,9 +251,10 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem)
ref->elem = tplg_elem_lookup(&tplg->hw_cfg_list,
ref->id, SND_TPLG_TYPE_HW_CONFIG, elem->index);
if (!ref->elem) {
SNDERR("cannot find HW config '%s'"
" referenced by link '%s'",
ref->id, elem->id);
snd_error(TOPOLOGY, "cannot find HW config '%s'"
" referenced by link '%s'",
ref->id, elem->id);
return -EINVAL;
}
@ -320,7 +322,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)
while ((s != NULL) && (i < SND_SOC_TPLG_MAX_FORMATS)) {
format = snd_pcm_format_value(s);
if (format == SND_PCM_FORMAT_UNKNOWN) {
SNDERR("unsupported stream format %s", s);
snd_error(TOPOLOGY, "unsupported stream format %s", s);
return -EINVAL;
}
@ -363,7 +365,7 @@ static int split_rate(struct snd_soc_tplg_stream_caps *caps, char *str)
rate = get_rate_value(s);
if (rate == SND_PCM_RATE_UNKNOWN) {
SNDERR("unsupported stream rate %s", s);
snd_error(TOPOLOGY, "unsupported stream rate %s", s);
return -EINVAL;
}
@ -762,7 +764,7 @@ static int tplg_parse_fe_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
if (strcmp(id, "id") == 0) {
if (tplg_get_unsigned(n, &dai_id, 0)) {
SNDERR("invalid fe dai ID");
snd_error(TOPOLOGY, "invalid fe dai ID");
return -EINVAL;
}
@ -1413,7 +1415,7 @@ static int get_audio_hw_format(const char *val)
if (strcasecmp(audio_hw_formats[i].name, val) == 0)
return audio_hw_formats[i].type;
SNDERR("invalid audio HW format %s", val);
snd_error(TOPOLOGY, "invalid audio HW format %s", val);
return -EINVAL;
}
@ -1480,7 +1482,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
provider_legacy = false;
if (strcmp(id, "bclk_master") == 0) {
SNDERR("deprecated option %s, please use 'bclk'", id);
snd_error(TOPOLOGY, "deprecated option %s, please use 'bclk'", id);
provider_legacy = true;
}
@ -1494,17 +1496,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "codec is slave"
*/
SNDERR("deprecated bclk value '%s'", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_slave")) {
SNDERR("deprecated bclk value '%s', use 'codec_consumer'", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_consumer'", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CC;
} else if (!strcmp(val, "codec_master")) {
SNDERR("deprecated bclk value '%s', use 'codec_provider", val);
snd_error(TOPOLOGY, "deprecated bclk value '%s', use 'codec_provider", val);
hw_cfg->bclk_provider = SND_SOC_TPLG_BCLK_CP;
} else if (!strcmp(val, "codec_provider")) {
@ -1532,7 +1534,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
provider_legacy = false;
if (strcmp(id, "fsync_master") == 0) {
SNDERR("deprecated option %s, please use 'fsync'", id);
snd_error(TOPOLOGY, "deprecated option %s, please use 'fsync'", id);
provider_legacy = true;
}
@ -1546,17 +1548,17 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "codec is slave"
*/
SNDERR("deprecated fsync value '%s'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_slave")) {
SNDERR("deprecated fsync value '%s', use 'codec_consumer'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_consumer'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_consumer")) {
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CC;
} else if (!strcmp(val, "codec_master")) {
SNDERR("deprecated fsync value '%s', use 'codec_provider'", val);
snd_error(TOPOLOGY, "deprecated fsync value '%s', use 'codec_provider'", val);
hw_cfg->fsync_provider = SND_SOC_TPLG_FSYNC_CP;
} else if (!strcmp(val, "codec_provider")) {
@ -1598,7 +1600,7 @@ int tplg_parse_hw_config(snd_tplg_t *tplg, snd_config_t *cfg,
/* For backwards capability,
* "master" == "for codec, mclk is input"
*/
SNDERR("deprecated mclk value '%s'", val);
snd_error(TOPOLOGY, "deprecated mclk value '%s'", val);
hw_cfg->mclk_direction = SND_SOC_TPLG_MCLK_CI;
} else if (!strcmp(val, "codec_mclk_in")) {
@ -2016,20 +2018,21 @@ next:
pcm = bin;
if (size < sizeof(*pcm)) {
SNDERR("pcm: small size %d", size);
snd_error(TOPOLOGY, "pcm: small size %d", size);
return -EINVAL;
}
if (sizeof(*pcm) != pcm->size) {
SNDERR("pcm: unknown element size %d (expected %zd)",
pcm->size, sizeof(*pcm));
snd_error(TOPOLOGY, "pcm: unknown element size %d (expected %zd)",
pcm->size, sizeof(*pcm));
return -EINVAL;
}
if (pcm->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
SNDERR("pcm: wrong number of streams %d", pcm->num_streams);
snd_error(TOPOLOGY, "pcm: wrong number of streams %d", pcm->num_streams);
return -EINVAL;
}
if (sizeof(*pcm) + pcm->priv.size > size) {
SNDERR("pcm: wrong private data size %d", pcm->priv.size);
snd_error(TOPOLOGY, "pcm: wrong private data size %d", pcm->priv.size);
return -EINVAL;
}
@ -2054,8 +2057,9 @@ next:
for (i = 0; i < pcm->num_streams; i++) {
stream = &pt->stream[i];
if (pcm->stream[i].size != sizeof(pcm->stream[0])) {
SNDERR("pcm: unknown stream structure size %d",
pcm->stream[i].size);
snd_error(TOPOLOGY, "pcm: unknown stream structure size %d",
pcm->stream[i].size);
return -EINVAL;
}
stream->name = pcm->stream[i].name;
@ -2075,8 +2079,9 @@ next:
cap = &caps[i];
pt->caps[i] = cap;
if (pcm->caps[i].size != sizeof(pcm->caps[0])) {
SNDERR("pcm: unknown caps structure size %d",
pcm->caps[i].size);
snd_error(TOPOLOGY, "pcm: unknown caps structure size %d",
pcm->caps[i].size);
return -EINVAL;
}
cap->name = pcm->caps[i].name;
@ -2123,7 +2128,7 @@ int tplg_decode_dai(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
SNDERR("not implemented");
snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
@ -2134,7 +2139,7 @@ int tplg_decode_cc(snd_tplg_t *tplg ATTRIBUTE_UNUSED,
void *bin ATTRIBUTE_UNUSED,
size_t size ATTRIBUTE_UNUSED)
{
SNDERR("not implemented");
snd_error(TOPOLOGY, "not implemented");
return -ENXIO;
}
@ -2165,24 +2170,25 @@ next:
link = bin;
if (size < sizeof(*link)) {
SNDERR("link: small size %d", size);
snd_error(TOPOLOGY, "link: small size %d", size);
return -EINVAL;
}
if (sizeof(*link) != link->size) {
SNDERR("link: unknown element size %d (expected %zd)",
link->size, sizeof(*link));
snd_error(TOPOLOGY, "link: unknown element size %d (expected %zd)",
link->size, sizeof(*link));
return -EINVAL;
}
if (link->num_streams > SND_SOC_TPLG_STREAM_CONFIG_MAX) {
SNDERR("link: wrong number of streams %d", link->num_streams);
snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (link->num_hw_configs > SND_SOC_TPLG_HW_CONFIG_MAX) {
SNDERR("link: wrong number of streams %d", link->num_streams);
snd_error(TOPOLOGY, "link: wrong number of streams %d", link->num_streams);
return -EINVAL;
}
if (sizeof(*link) + link->priv.size > size) {
SNDERR("link: wrong private data size %d", link->priv.size);
snd_error(TOPOLOGY, "link: wrong private data size %d", link->priv.size);
return -EINVAL;
}
@ -2204,8 +2210,9 @@ next:
for (i = 0; i < link->num_streams; i++) {
stream = &streams[i];
if (link->stream[i].size != sizeof(link->stream[0])) {
SNDERR("link: unknown stream structure size %d",
link->stream[i].size);
snd_error(TOPOLOGY, "link: unknown stream structure size %d",
link->stream[i].size);
return -EINVAL;
}
stream->name = link->stream[i].name;
@ -2222,8 +2229,9 @@ next:
for (i = 0; i < link->num_hw_configs; i++) {
hw = &hws[i];
if (link->hw_config[i].size != sizeof(link->hw_config[0])) {
SNDERR("link: unknown hw_config structure size %d",
link->hw_config[i].size);
snd_error(TOPOLOGY, "link: unknown hw_config structure size %d",
link->hw_config[i].size);
return -EINVAL;
}
hw->id = link->hw_config[i].id;
@ -2243,14 +2251,14 @@ next:
hw->rx_slots = link->hw_config[i].rx_slots;
hw->tx_channels = link->hw_config[i].tx_channels;
if (hw->tx_channels > SND_SOC_TPLG_MAX_CHAN) {
SNDERR("link: wrong tx channels %d", hw->tx_channels);
snd_error(TOPOLOGY, "link: wrong tx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->tx_channels; j++)
hw->tx_chanmap[j] = link->hw_config[i].tx_chanmap[j];
hw->rx_channels = link->hw_config[i].rx_channels;
if (hw->rx_channels > SND_SOC_TPLG_MAX_CHAN) {
SNDERR("link: wrong rx channels %d", hw->tx_channels);
snd_error(TOPOLOGY, "link: wrong rx channels %d", hw->tx_channels);
return -EINVAL;
}
for (j = 0; j < hw->rx_channels; j++)

View file

@ -446,8 +446,9 @@ static int tplg_save(snd_tplg_t *tplg, struct tplg_buf *dst,
if (gindex >= 0 && elem->index != gindex)
continue;
if (tptr->save == NULL && tptr->gsave == NULL) {
SNDERR("unable to create %s block (no callback)",
tptr->id);
snd_error(TOPOLOGY, "unable to create %s block (no callback)",
tptr->id);
err = -ENXIO;
goto _err;
}
@ -482,8 +483,9 @@ static int tplg_save(snd_tplg_t *tplg, struct tplg_buf *dst,
}
err = tptr->save(tplg, elem, dst, count > 1 ? pfx2 : prefix);
if (err < 0) {
SNDERR("failed to save %s elements: %s",
tptr->id, snd_strerror(-err));
snd_error(TOPOLOGY, "failed to save %s elements: %s",
tptr->id, snd_strerror(-err));
goto _err;
}
}
@ -607,7 +609,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
/* always load configuration - check */
err = snd_input_buffer_open(&in, buf.dst, strlen(buf.dst));
if (err < 0) {
SNDERR("could not create input buffer");
snd_error(TOPOLOGY, "could not create input buffer");
goto _err;
}
@ -620,7 +622,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
err = snd_config_load(top, in);
snd_input_close(in);
if (err < 0) {
SNDERR("could not load configuration");
snd_error(TOPOLOGY, "could not load configuration");
snd_config_delete(top);
goto _err;
}
@ -628,7 +630,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
if (flags & SND_TPLG_SAVE_SORT) {
top2 = sort_config(NULL, top);
if (top2 == NULL) {
SNDERR("could not sort configuration");
snd_error(TOPOLOGY, "could not sort configuration");
snd_config_delete(top);
err = -EINVAL;
goto _err;
@ -641,7 +643,7 @@ int snd_tplg_save(snd_tplg_t *tplg, char **dst, int flags)
err = save_config(&buf2, 0, NULL, top);
snd_config_delete(top);
if (err < 0) {
SNDERR("could not save configuration");
snd_error(TOPOLOGY, "could not save configuration");
goto _err;
}

View file

@ -79,7 +79,7 @@ int tplg_parse_text(snd_tplg_t *tplg, snd_config_t *cfg,
if (strcmp(id, "values") == 0) {
err = parse_text_values(n, elem);
if (err < 0) {
SNDERR("error: failed to parse text values");
snd_error(TOPOLOGY, "error: failed to parse text values");
return err;
}
continue;