devc->cur_samplerate = devc->prof->max_samplerate;
/* Register the device with libsigrok. */
- sdi = sr_dev_inst_new(SR_ST_INITIALIZING,
- "ChronoVu", devc->prof->modelname, NULL);
- if (!sdi) {
- sr_err("Failed to create device instance.");
- ret = SR_ERR;
- goto err_free_final_buf;
- }
+ sdi = sr_dev_inst_new();
+ sdi->status = SR_ST_INITIALIZING;
+ sdi->vendor = g_strdup("ChronoVu");
+ sdi->model = g_strdup(devc->prof->modelname);
sdi->driver = di;
sdi->priv = devc;
*devices = g_slist_append(*devices, sdi);
drvc->instances = g_slist_append(drvc->instances, sdi);
- return SR_OK;
+ if (ret == SR_OK)
+ return SR_OK;
err_free_dev_inst:
sr_dev_inst_free(sdi);
-err_free_final_buf:
g_free(devc->final_buf);
err_free_devc:
g_free(devc);
struct dev_context *devc;
int ret;
- ret = SR_ERR;
-
if (!(devc = sdi->priv))
return SR_ERR_BUG;
sdi->status = SR_ST_ACTIVE;
- return SR_OK;
+ if (ret == SR_OK)
+ return SR_OK;
err_ftdi_free:
ftdi_free(devc->ftdic); /* Close device (if open), free FTDI context. */