Remove some dead code (comparisons between 0 and unsigned integers).

Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
This commit is contained in:
Diego E. 'Flameeyes' Pettenò 2008-11-21 13:09:45 +01:00
parent 94ae24cfd6
commit 50f01e48af

View file

@ -600,10 +600,6 @@ static int get_controls(int cardno, snd_config_t *top)
goto _close; goto _close;
} }
count = snd_ctl_elem_list_get_count(list); count = snd_ctl_elem_list_get_count(list);
if (count < 0) {
err = 0;
goto _close;
}
err = snd_config_compound_add(card, "control", count > 0, &control); err = snd_config_compound_add(card, "control", count > 0, &control);
if (err < 0) { if (err < 0) {
error("snd_config_compound_add: %s", snd_strerror(err)); error("snd_config_compound_add: %s", snd_strerror(err));
@ -1183,10 +1179,6 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
} }
if (strcmp(fld, "iface") == 0) { if (strcmp(fld, "iface") == 0) {
iface = (snd_ctl_elem_iface_t)config_iface(n); iface = (snd_ctl_elem_iface_t)config_iface(n);
if (iface < 0) {
cerror(doit, "control.%d.%s is invalid", numid, fld);
return -EINVAL;
}
continue; continue;
} }
if (strcmp(fld, "device") == 0) { if (strcmp(fld, "device") == 0) {
@ -1243,8 +1235,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
snd_ctl_elem_info_set_numid(info, numid); snd_ctl_elem_info_set_numid(info, numid);
err = snd_ctl_elem_info(handle, info); err = snd_ctl_elem_info(handle, info);
} }
if (err < 0) { if (err < 0 && name) {
if (iface >= 0 && name) {
snd_ctl_elem_info_set_numid(info, 0); snd_ctl_elem_info_set_numid(info, 0);
snd_ctl_elem_info_set_interface(info, iface); snd_ctl_elem_info_set_interface(info, iface);
snd_ctl_elem_info_set_device(info, device); snd_ctl_elem_info_set_device(info, device);
@ -1261,7 +1252,6 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
} }
} }
} }
}
if (err < 0) { if (err < 0) {
cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err)); cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err));
return -ENOENT; return -ENOENT;
@ -1372,8 +1362,7 @@ static int set_control(snd_ctl_t *handle, snd_config_t *control,
if (snd_config_get_id(n, &id) < 0) if (snd_config_get_id(n, &id) < 0)
continue; continue;
idx = atoi(id); idx = atoi(id);
if (idx < 0 || idx >= count || if (idx >= count || set[idx]) {
set[idx]) {
cerror(doit, "bad control.%d.value index", numid); cerror(doit, "bad control.%d.value index", numid);
if (!force_restore || !doit) if (!force_restore || !doit)
return -EINVAL; return -EINVAL;