X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fmicrochip-pickit2%2Fapi.c;h=d8a757283655496d10b9a2c2d26eed2c7c875694;hb=81ceb6a51dd666987fb5c67b83c5ba14d105b301;hp=48fb849a9a001e3f14042bfa85f7d876a73d2b3d;hpb=3aadf5c479924dfe8a25753bdfa785d7a9c3771b;p=libsigrok.git diff --git a/src/hardware/microchip-pickit2/api.c b/src/hardware/microchip-pickit2/api.c index 48fb849a..d8a75728 100644 --- a/src/hardware/microchip-pickit2/api.c +++ b/src/hardware/microchip-pickit2/api.c @@ -159,9 +159,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) sdi->connection_id = g_strdup(conn); /* Create the logic channels group. */ - cg = g_malloc0(sizeof(*cg)); - sdi->channel_groups = g_slist_append(NULL, cg); - cg->name = g_strdup("Logic"); + cg = sr_channel_group_new(sdi, "Logic", NULL); ch_count = ARRAY_SIZE(channel_names); for (ch_idx = 0; ch_idx < ch_count; ch_idx++) { ch = sr_channel_new(sdi, ch_idx, SR_CHANNEL_LOGIC, @@ -232,6 +230,8 @@ static int dev_close(struct sr_dev_inst *sdi) usb = sdi->conn; devc = sdi->priv; + if (!usb) + return SR_OK; if (!usb->devhdl) return SR_OK;