]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
scpi-pps: Fix compile warning.
[libsigrok.git] / src / hardware / scpi-pps / api.c
index 9ca71d3d01872f4d5103ac512e44cc3908273511..2f4bdc9308e93e6c36203a43b21529b900f6251a 100644 (file)
@@ -56,7 +56,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        GMatchInfo *model_mi;
        GSList *l;
        uint64_t mask;
-       unsigned int ch_num, ch_idx, old_idx, i, j;
+       unsigned int ch_num, ch_idx, i, j;
        const char *vendor;
        char ch_name[16];
 
@@ -95,7 +95,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        ch_idx = 0;
        for (ch_num = 0; ch_num < device->num_channels; ch_num++) {
                /* Create one channel per measurable output unit. */
-               old_idx = ch_idx;
                for (i = 0; i < ARRAY_SIZE(pci); i++) {
                        if (!scpi_cmd_get(sdi, pci[i].command))
                                continue;
@@ -109,14 +108,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                        ch->priv = pch;
                        sdi->channels = g_slist_append(sdi->channels, ch);
                }
-               if (ch_idx == old_idx) {
-                       /*
-                        * Didn't create any channels for this hardware output.
-                        * This can happen if the device has no measurement capability.
-                        */
-                       g_free(pch);
-                       continue;
-               }
        }
 
        for (i = 0; i < device->num_channel_groups; i++) {
@@ -331,6 +322,9 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
        int ret;
        const char *s;
 
+       if (!sdi)
+               return SR_ERR_ARG;
+
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR_DEV_CLOSED;
 
@@ -359,10 +353,6 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
                }
        } else {
                /* Channel group specified. */
-               if (!sdi)
-                       return SR_ERR_ARG;
-               if (g_slist_length(cg->channels) > 1)
-                       return SR_ERR_NA;
                ch = cg->channels->data;
                pch = ch->priv;
                switch (key) {