X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fappa-55ii%2Fapi.c;h=771a686c44d5d98837744708db6e8721e756f05a;hb=a445f8aa080d18964ac45f352f6e61022b0a12bd;hp=a8c8a841adff89bb18779dafa8b43cb27ca545f8;hpb=42a47a9a4b25728436bf7fa8c798b4f8f05a789a;p=libsigrok.git diff --git a/src/hardware/appa-55ii/api.c b/src/hardware/appa-55ii/api.c index a8c8a841..771a686c 100644 --- a/src/hardware/appa-55ii/api.c +++ b/src/hardware/appa-55ii/api.c @@ -81,8 +81,8 @@ static GSList *scan(GSList *options) if (!serialcomm) serialcomm = "9600/8n1"; - 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; @@ -99,28 +99,20 @@ static GSList *scan(GSList *options) sr_info("Found device on port %s.", conn); - sdi = sr_dev_inst_new(); + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup("APPA"); sdi->model = g_strdup("55II"); - - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - goto scan_cleanup; - } - + devc = g_malloc0(sizeof(struct dev_context)); devc->data_source = DEFAULT_DATA_SOURCE; - sdi->inst_type = SR_INST_SERIAL; sdi->conn = serial; sdi->priv = devc; sdi->driver = di; - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T1"))) - goto scan_cleanup; + ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T1"); sdi->channels = g_slist_append(sdi->channels, ch); - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T2"))) - goto scan_cleanup; + ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "T2"); sdi->channels = g_slist_append(sdi->channels, ch); drvc->instances = g_slist_append(drvc->instances, sdi);