alsactl: Fix restore / init call behaviour when driver contains more controls

Fix check when driver contains more controls than state file. In this case,
initialization procedure should be run, too.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2008-11-21 14:44:31 +01:00
parent 6232f1c96c
commit 05f78cc681

View file

@ -1162,7 +1162,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
return -EINVAL; return -EINVAL;
} }
numid = atoi(id); numid = atoi(id);
if (numid > *maxnumid) if ((int)numid > *maxnumid)
*maxnumid = numid; *maxnumid = numid;
snd_config_for_each(i, next, control) { snd_config_for_each(i, next, control) {
snd_config_t *n = snd_config_iterator_entry(i); snd_config_t *n = snd_config_iterator_entry(i);
@ -1398,7 +1398,7 @@ static int set_controls(int card, snd_config_t *top, int doit)
snd_ctl_card_info_t *info; snd_ctl_card_info_t *info;
snd_config_t *control; snd_config_t *control;
snd_config_iterator_t i, next; snd_config_iterator_t i, next;
int err, maxnumid; int err, maxnumid = -1;
char name[32], tmpid[16]; char name[32], tmpid[16];
const char *id; const char *id;
snd_ctl_card_info_alloca(&info); snd_ctl_card_info_alloca(&info);
@ -1442,7 +1442,7 @@ static int set_controls(int card, snd_config_t *top, int doit)
/* check if we have additional controls in driver */ /* check if we have additional controls in driver */
/* in this case we should go through init procedure */ /* in this case we should go through init procedure */
if (!doit) { if (!doit && maxnumid >= 0) {
snd_ctl_elem_id_t *id; snd_ctl_elem_id_t *id;
snd_ctl_elem_info_t *info; snd_ctl_elem_info_t *info;
snd_ctl_elem_id_alloca(&id); snd_ctl_elem_id_alloca(&id);