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:
parent
2887799404
commit
d9a3c0b749
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue