X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fcem-dt-885x%2Fapi.c;h=5c259542b8babca76036fd096284490780d42290;hb=5e23fcab889c62864b92aa3ad6902ce3e9f5be49;hp=c8ca2b8f7a648b9003aa1eb9aee05052a6961ae2;hpb=aac29cc192ccf82b64e77b5e6b11b411da32deed;p=libsigrok.git diff --git a/src/hardware/cem-dt-885x/api.c b/src/hardware/cem-dt-885x/api.c index c8ca2b8f..5c259542 100644 --- a/src/hardware/cem-dt-885x/api.c +++ b/src/hardware/cem-dt-885x/api.c @@ -82,7 +82,6 @@ static GSList *scan(GSList *options) struct sr_config *src; struct sr_serial_dev_inst *serial; struct sr_dev_inst *sdi; - struct sr_channel *ch; GSList *l, *devices; gint64 start; const char *conn; @@ -97,8 +96,7 @@ static GSList *scan(GSList *options) if (!conn) return NULL; - if (!(serial = sr_serial_dev_inst_new(conn, SERIALCOMM))) - return NULL; + serial = sr_serial_dev_inst_new(conn, SERIALCOMM); if (serial_open(serial, SERIAL_RDONLY) != SR_OK) return NULL; @@ -113,26 +111,17 @@ static GSList *scan(GSList *options) sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("CEM"); sdi->model = g_strdup("DT-885x"); - - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_dbg("Device context malloc failed."); - return NULL; - } + devc = g_malloc0(sizeof(struct dev_context)); devc->cur_mqflags = 0; devc->recording = -1; devc->cur_meas_range = 0; devc->cur_data_source = DATA_SOURCE_LIVE; devc->enable_data_source_memory = FALSE; - - if (!(sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM))) - return NULL; - + sdi->conn = sr_serial_dev_inst_new(conn, SERIALCOMM); sdi->inst_type = SR_INST_SERIAL; sdi->priv = devc; sdi->driver = di; - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "SPL"))) - return NULL; - sdi->channels = g_slist_append(sdi->channels, ch); + sr_channel_new(sdi, 0, SR_CHANNEL_ANALOG, TRUE, "SPL"); drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); break;