tools: ctl: Fix various errors

Most of the errors are unused variables, plus an unused label. Those are
benign.

One of the errors was the following:

/work/repos/sof/tools/ctl/ctl.c: In function ‘ctl_set_get’:
/work/repos/sof/tools/ctl/ctl.c:497:1: error: control reaches end of
non-void function [-Werror=return-type]
  497 | }
      | ^

This error had caused an undefined-behaviour-driven bug internally (an
error being displayed with a return code of 0, when it shouldn't have
been possible to display that message if the return code was 0). At line
614 of the old code, the message "Error: could not Set control, ret:0"
was displayed.

The errors only show up when you add -Wall -Werror to the compile
options of ctl, which I will do in the next commit.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit is contained in:
Paul Olaru 2021-11-09 15:41:28 +02:00 committed by Daniel Baluta
parent a4606425fa
commit e3ac593f86
1 changed files with 2 additions and 8 deletions

View File

@ -287,11 +287,9 @@ static int ctl_setup(struct ctl_data *ctl_data)
{
int mode = SND_CTL_NONBLOCK;
int ctrl_size;
int buffer_size;
int read;
int write;
int type;
char opt;
int ret;
/* Open the device, mixer control and get read/write/type properties.
@ -376,8 +374,6 @@ static int ctl_setup(struct ctl_data *ctl_data)
}
return ret;
buff_free:
buffer_free(ctl_data);
value_free:
snd_ctl_elem_value_free(ctl_data->value);
@ -494,6 +490,8 @@ static int ctl_set_get(struct ctl_data *ctl_data)
}
fprintf(stdout, "Success.\n");
}
return 0;
}
int main(int argc, char *argv[])
@ -503,10 +501,6 @@ int main(int argc, char *argv[])
struct ctl_data *ctl_data;
char nname[256];
int ret = 0;
int n = 0;
int read;
int write;
int type;
int opt;
struct sof_abi_hdr *hdr;