rigol-ds: Fix check for probe group validity.

This commit is contained in:
Martin Ling 2014-01-14 20:48:17 +00:00 committed by Uwe Hermann
parent 55eb33dbf8
commit 969edf6306
1 changed files with 8 additions and 12 deletions

View File

@ -464,12 +464,10 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi,
return SR_ERR_ARG; return SR_ERR_ARG;
/* If a probe group is specified, it must be a valid one. */ /* If a probe group is specified, it must be a valid one. */
if (probe_group) { if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
if (probe_group != &devc->analog_groups[0] {
&& probe_group != &devc->analog_groups[1]) { sr_err("Invalid probe group specified.");
sr_err("Invalid probe group specified."); return SR_ERR;
return SR_ERR;
}
} }
switch (id) { switch (id) {
@ -510,12 +508,10 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi,
return SR_ERR_DEV_CLOSED; return SR_ERR_DEV_CLOSED;
/* If a probe group is specified, it must be a valid one. */ /* If a probe group is specified, it must be a valid one. */
if (probe_group) { if (probe_group && !g_slist_find(sdi->probe_groups, probe_group))
if (probe_group != &devc->analog_groups[0] {
&& probe_group != &devc->analog_groups[1]) { sr_err("Invalid probe group specified.");
sr_err("Invalid probe group specified."); return SR_ERR;
return SR_ERR;
}
} }
ret = SR_OK; ret = SR_OK;