]> sigrok.org Git - libsigrok.git/commitdiff
brymen-bm86x: drop redundant free call, fixup channel index
authorGerhard Sittig <redacted>
Tue, 11 Dec 2018 15:52:06 +0000 (16:52 +0100)
committerUwe Hermann <redacted>
Thu, 20 Dec 2018 15:19:42 +0000 (16:19 +0100)
Remove a free() call in an error path for a list which immediately
before the call was determined to be NULL. Use index 0 and 1 for
channels P1 and P2 respectively (the previous implementation used 0
for both channels).

src/hardware/brymen-bm86x/api.c

index f0713010ea820ac60706f987ace12ec3545b81a4..f7d9d23fe2254069c31236cdf29ed27dae6a4357 100644 (file)
@@ -59,10 +59,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
        }
 
        devices = NULL;
-       if (!(usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn))) {
-               g_slist_free_full(usb_devices, g_free);
+       if (!(usb_devices = sr_usb_find(drvc->sr_ctx->libusb_ctx, conn)))
                return NULL;
-       }
 
        for (l = usb_devices; l; l = l->next) {
                usb = l->data;
@@ -74,7 +72,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                devc = g_malloc0(sizeof(struct dev_context));
                sdi->priv = devc;
                sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P1");
-               sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "P2");
+               sr_channel_new(sdi, 1, SR_CHANNEL_ANALOG, TRUE, "P2");
 
                sdi->inst_type = SR_INST_USB;
                sdi->conn = usb;