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).
This commit is contained in:
Gerhard Sittig 2018-12-11 16:52:06 +01:00 committed by Uwe Hermann
parent 2887799404
commit d9a3c0b749
1 changed files with 2 additions and 4 deletions

View 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;