]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/zeroplus-logic-cube/api.c
Consistently use g_malloc0() for allocating devc.
[libsigrok.git] / src / hardware / zeroplus-logic-cube / api.c
index 9789713d8c34c9163e47478acc113334dceedff3..2cf5aaf117bb924e6bbcb62758802a9351b057ed 100644 (file)
@@ -49,6 +49,7 @@ static const struct zp_model zeroplus_models[] = {
        {0x0c12, 0x700d, "LAP-C(322000)", 32, 2048, 200},
        {0x0c12, 0x700e, "LAP-C(16032)",  16, 32,   100},
        {0x0c12, 0x7016, "LAP-C(162000)", 16, 2048, 200},
+       {0x0c12, 0x7100, "AKIP-9101", 16, 256, 200},
        { 0, 0, 0, 0, 0, 0 }
 };
 
@@ -221,21 +222,16 @@ static GSList *scan(GSList *options)
                sr_info("Found ZEROPLUS %s.", prof->model_name);
 
                /* Register the device with libsigrok. */
-               if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE,
-                               VENDOR_NAME, prof->model_name, NULL))) {
-                       sr_err("%s: sr_dev_inst_new failed", __func__);
-                       return NULL;
-               }
+               sdi = g_malloc0(sizeof(struct sr_dev_inst));
+               sdi->status = SR_ST_INACTIVE;
+               sdi->vendor = g_strdup(VENDOR_NAME);
+               sdi->model = g_strdup(prof->model_name);
                sdi->driver = di;
                sdi->serial_num = g_strdup(serial_num);
                sdi->connection_id = g_strdup(connection_id);
 
                /* Allocate memory for our private driver context. */
-               if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
-                       sr_err("Device context malloc failed.");
-                       return NULL;
-               }
-
+               devc = g_malloc0(sizeof(struct dev_context));
                sdi->priv = devc;
                devc->prof = prof;
                devc->num_channels = prof->channels;