]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/zeroplus-logic-cube/api.c
baylibre-acme: Add support for probe factor setting.
[libsigrok.git] / src / hardware / zeroplus-logic-cube / api.c
index 76ae1e331d1112808d75babe1d2e736485f0824e..fa6ef1dc3c76a58ea02c47fb5d3cf412dbe5d999 100644 (file)
@@ -222,7 +222,7 @@ static GSList *scan(GSList *options)
                sr_info("Found ZEROPLUS %s.", prof->model_name);
 
                /* Register the device with libsigrok. */
-               sdi = sr_dev_inst_new();
+               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);
@@ -231,11 +231,7 @@ static GSList *scan(GSList *options)
                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;
@@ -252,9 +248,8 @@ static GSList *scan(GSList *options)
 
                /* Fill in channellist according to this device's profile. */
                for (j = 0; j < devc->num_channels; j++) {
-                       if (!(ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
-                                       channel_names[j])))
-                               return NULL;
+                       ch = sr_channel_new(j, SR_CHANNEL_LOGIC, TRUE,
+                                       channel_names[j]);
                        sdi->channels = g_slist_append(sdi->channels, ch);
                }