]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/chronovu-la/api.c
rigol-ds: Add more debug output.
[libsigrok.git] / src / hardware / chronovu-la / api.c
index 3dc0598ec30aba688b00c712012dff6c3cb31029..c9d7ec11cbd1aca58d38544ad67adcfd91831f54 100644 (file)
@@ -87,7 +87,7 @@ static int add_device(int idx, int model, GSList **devices)
        drvc = di->priv;
 
        /* Allocate memory for our private device context. */
-       devc = g_try_malloc(sizeof(struct dev_context));
+       devc = g_malloc0(sizeof(struct dev_context));
 
        /* Set some sane defaults. */
        devc->prof = &cv_profiles[model];
@@ -120,7 +120,7 @@ static int add_device(int idx, int model, GSList **devices)
        devc->cur_samplerate = devc->prof->max_samplerate;
 
        /* Register the device with libsigrok. */
-       sdi = sr_dev_inst_new();
+       sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
        sdi->vendor = g_strdup("ChronoVu");
        sdi->model = g_strdup(devc->prof->modelname);
@@ -128,11 +128,8 @@ static int add_device(int idx, int model, GSList **devices)
        sdi->priv = devc;
 
        for (i = 0; i < devc->prof->num_channels; i++) {
-               if (!(ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
-                                         cv_channel_names[i]))) {
-                       ret = SR_ERR;
-                       goto err_free_dev_inst;
-               }
+               ch = sr_channel_new(i, SR_CHANNEL_LOGIC, TRUE,
+                                   cv_channel_names[i]);
                sdi->channels = g_slist_append(sdi->channels, ch);
        }
 
@@ -142,9 +139,6 @@ static int add_device(int idx, int model, GSList **devices)
        if (ret == SR_OK)
                return SR_OK;
 
-err_free_dev_inst:
-       sr_dev_inst_free(sdi);
-       g_free(devc->final_buf);
 err_free_devc:
        g_free(devc);