]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/colead-slm/api.c
Don't check sr_channel_new() return value (always succeeds).
[libsigrok.git] / src / hardware / colead-slm / api.c
index 9ea441781520244c00e52ffaf5a4d5215044fc7d..4c35f0fbc1b831ff27f5f76b0ee3aa697b93ba69 100644 (file)
@@ -82,23 +82,17 @@ static GSList *scan(GSList *options)
        if (!serialcomm)
                serialcomm = SERIALCOMM;
 
-       if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, "Colead",
-                       "SL-5868P", NULL)))
-               return NULL;
-
-       if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) {
-               sr_dbg("Device context malloc failed.");
-               return NULL;
-       }
-
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
+       sdi->status = SR_ST_INACTIVE;
+       sdi->vendor = g_strdup("Colead");
+       sdi->model = g_strdup("SL-5868P");
+       devc = g_malloc0(sizeof(struct dev_context));
        if (!(sdi->conn = sr_serial_dev_inst_new(conn, serialcomm)))
                return NULL;
-
        sdi->inst_type = SR_INST_SERIAL;
        sdi->priv = devc;
        sdi->driver = di;
-       if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1")))
-               return NULL;
+       ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1");
        sdi->channels = g_slist_append(sdi->channels, ch);
        drvc->instances = g_slist_append(drvc->instances, sdi);
        devices = g_slist_append(devices, sdi);