ucm: keep original device name for logs

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2025-11-18 14:55:25 +01:00
parent b3e4b15583
commit 5c4a683bd0
4 changed files with 9 additions and 4 deletions

View file

@ -953,7 +953,7 @@ static int execute_component_seq(snd_use_case_mgr_t *uc_mgr,
int err;
snd_trace(UCM, "execute component sequence '%s': %s", cmpt_seq->device ?
cmpt_seq->device->name : NULL, uc_mgr_enable_str(cmpt_seq->enable));
cmpt_seq->device->orig_name : NULL, uc_mgr_enable_str(cmpt_seq->enable));
/* enter component domain and store cdev for the component */
uc_mgr->in_component_domain = 1;

View file

@ -1608,6 +1608,9 @@ static int parse_device(snd_use_case_mgr_t *uc_mgr,
INIT_LIST_HEAD(&device->value_list);
list_add_tail(&device->list, &verb->device_list);
device->name = name;
device->orig_name = strdup(name);
if (device->orig_name == NULL)
return -ENOMEM;
/* in-place evaluation */
err = uc_mgr_evaluate_inplace(uc_mgr, cfg);
@ -1845,7 +1848,7 @@ static int verb_dev_list_add(struct use_case_verb *verb,
if (list_empty(&device->dev_list.list)) {
device->dev_list.type = dst_type;
} else {
snd_error(UCM, "incompatible device list type ('%s', '%s')", device->name, src);
snd_error(UCM, "incompatible device list type ('%s', '%s')", device->orig_name, src);
return -EINVAL;
}
}
@ -1984,7 +1987,7 @@ static int verb_normalize_device_names(snd_use_case_mgr_t *uc_mgr, struct use_ca
index++;
} while (index < 100); /* Safety limit */
if (index >= 100) {
snd_error(UCM, "too many device name conflicts for '%s'", norm_name);
snd_error(UCM, "too many device name conflicts for '%s'", orig_name);
err = -EINVAL;
goto __error;
}
@ -1993,7 +1996,7 @@ static int verb_normalize_device_names(snd_use_case_mgr_t *uc_mgr, struct use_ca
__no_colon:
err = parse_device_index(&norm_name, &index);
if (err < 0) {
snd_error(UCM, "cannot parse device name '%s'", device->name);
snd_error(UCM, "cannot parse device name '%s'", orig_name);
goto __error;
}

View file

@ -165,6 +165,7 @@ struct use_case_device {
struct list_head active_list;
char *name;
char *orig_name;
char *comment;
/* device enable and disable sequences */

View file

@ -597,6 +597,7 @@ void uc_mgr_free_modifier(struct list_head *base)
void uc_mgr_free_device(struct use_case_device *dev)
{
free(dev->name);
free(dev->orig_name);
free(dev->comment);
uc_mgr_free_sequence(&dev->enable_list);
uc_mgr_free_sequence(&dev->disable_list);