Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tools/tplg_parser/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,16 @@ int tplg_create_controls(struct tplg_context *ctx, int num_kcontrols,
for (j = 0; j < num_kcontrols; j++) {

ctl_hdr = tplg_get(ctx);

#define MAX_CONTROL_NAME_LEN 64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be found in an ALSA header file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgirdwood is this approach fine or should I change the test in any other better way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to #include the correct ALSA header file and use its macro for this size.

// if (strlen(ctl_hdr->name) > MAX_CONTROL_NAME_LEN) {
// fprintf(stderr, "error: control name too long: %s\n", ctl_hdr->name);
// return -EINVAL;
// }
Comment on lines +103 to +107
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assume this will be an error message too when ready ?

mixer_ctl = (struct snd_soc_tplg_mixer_control *)ctl_hdr;
if (strlen(mixer_ctl->name) > MAX_CONTROL_NAME_LEN) {
fprintf(stderr, "error: control name too long: %s\n", mixer_ctl->name);
return -EINVAL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix indentation

}
/* load control based on type */
switch (ctl_hdr->ops.info) {
case SND_SOC_TPLG_CTL_VOLSW:
Expand Down