From: Bert Vermeulen Date: Sun, 3 Nov 2013 13:11:43 +0000 (+0100) Subject: rigol-ds1xx2: Minor coding style fixes X-Git-Tag: libsigrok-0.3.0~573 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=78bcc55afa19dc2d8432afccf2fb78a0114db509;p=libsigrok.git rigol-ds1xx2: Minor coding style fixes --- diff --git a/hardware/rigol-ds1xx2/api.c b/hardware/rigol-ds1xx2/api.c index e4413807..2df009dd 100644 --- a/hardware/rigol-ds1xx2/api.c +++ b/hardware/rigol-ds1xx2/api.c @@ -46,7 +46,7 @@ static const int32_t hwcaps[] = { static const int32_t analog_hwcaps[] = { SR_CONF_NUM_VDIV, SR_CONF_VDIV, - SR_CONF_COUPLING + SR_CONF_COUPLING, }; static const uint64_t timebases[][2] = { @@ -487,10 +487,8 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, case SR_CONF_VDIV: g_variant_get(data, "(tt)", &p, &q); for (i = 0; i < 2; i++) { - if (probe_group == &devc->analog_groups[i]) - { - for (j = 0; j < ARRAY_SIZE(vdivs); j++) - { + if (probe_group == &devc->analog_groups[i]) { + for (j = 0; j < ARRAY_SIZE(vdivs); j++) { if (vdivs[j][0] != p || vdivs[j][1] != q) continue; devc->vdiv[i] = (float)p / q; @@ -502,14 +500,15 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi, } return SR_ERR_NA; case SR_CONF_COUPLING: + if (!probe_group) { + sr_err("No probe group specified."); + return SR_ERR_PROBE_GROUP; + } tmp_str = g_variant_get_string(data, NULL); for (i = 0; i < 2; i++) { - if (probe_group == &devc->analog_groups[i]) - { - for (j = 0; j < ARRAY_SIZE(coupling); j++) - { - if (!strcmp(tmp_str, coupling[j])) - { + if (probe_group == &devc->analog_groups[i]) { + for (j = 0; j < ARRAY_SIZE(coupling); j++) { + if (!strcmp(tmp_str, coupling[j])) { g_free(devc->coupling[i]); devc->coupling[i] = g_strdup(coupling[j]); return set_cfg(sdi, ":CHAN%d:COUP %s", i + 1,