dslogic: Fix incorrect samplerate setting.

This commit is contained in:
Carl-Fredrik Sundström 2015-06-22 16:53:51 +02:00 committed by Uwe Hermann
parent aae2273b99
commit 65e0036635
1 changed files with 4 additions and 5 deletions

View File

@ -501,8 +501,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
{ {
struct dev_context *devc; struct dev_context *devc;
uint64_t arg; uint64_t arg;
unsigned int i; int i, ret;
int ret;
(void)cg; (void)cg;
@ -519,13 +518,13 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
switch (key) { switch (key) {
case SR_CONF_SAMPLERATE: case SR_CONF_SAMPLERATE:
arg = g_variant_get_uint64(data); arg = g_variant_get_uint64(data);
for (i = 0; i < ARRAY_SIZE(samplerates); i++) { for (i = 0; i < devc->num_samplerates; i++) {
if (samplerates[i] == arg) { if (devc->samplerates[i] == arg) {
devc->cur_samplerate = arg; devc->cur_samplerate = arg;
break; break;
} }
} }
if (i == ARRAY_SIZE(samplerates)) if (i == devc->num_samplerates)
ret = SR_ERR_ARG; ret = SR_ERR_ARG;
break; break;
case SR_CONF_LIMIT_SAMPLES: case SR_CONF_LIMIT_SAMPLES: