From d9a3c0b749042279cdc48208ebf802abad028b2b Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Tue, 11 Dec 2018 16:52:06 +0100 Subject: [PATCH] brymen-bm86x: drop redundant free call, fixup channel index 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/hardware/brymen-bm86x/api.c b/src/hardware/brymen-bm86x/api.c index f0713010..f7d9d23f 100644 --- a/src/hardware/brymen-bm86x/api.c +++ b/src/hardware/brymen-bm86x/api.c @@ -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;