X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Flink-mso19%2Fapi.c;h=451cc9347a163d94e8f13196f866aee77cf2a610;hb=d50725e0126a5d52d97e7ea49e37c66c15108156;hp=29a5952ac03587a153fa9cfa9ce15b1596984b2d;hpb=aed4ad0beaf64062752039a13f9a95326aa1df87;p=libsigrok.git diff --git a/src/hardware/link-mso19/api.c b/src/hardware/link-mso19/api.c index 29a5952a..451cc934 100644 --- a/src/hardware/link-mso19/api.c +++ b/src/hardware/link-mso19/api.c @@ -178,10 +178,7 @@ static GSList *scan(GSList *options) //Create the device context and set its params struct dev_context *devc; - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return devices; - } + devc = g_malloc0(sizeof(struct dev_context)); if (mso_parse_serial(iSerial, iProduct, devc) != SR_OK) { sr_err("Invalid iSerial: %s.", iSerial); @@ -198,13 +195,13 @@ static GSList *scan(GSList *options) devc->protocol_trigger.mask[i] = 0xff; } - if (!(devc->serial = sr_serial_dev_inst_new(conn, serialcomm))) { - g_free(devc); - return devices; - } + devc->serial = sr_serial_dev_inst_new(conn, serialcomm); - struct sr_dev_inst *sdi = sr_dev_inst_new(SR_ST_INACTIVE, - manufacturer, product, hwrev); + struct sr_dev_inst *sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->vendor = g_strdup(manufacturer); + sdi->model = g_strdup(product); + sdi->version = g_strdup(hwrev); if (!sdi) { sr_err("Unable to create device instance for %s", @@ -220,9 +217,8 @@ static GSList *scan(GSList *options) for (i = 0; i < NUM_CHANNELS; i++) { struct sr_channel *ch; chtype = (i == 0) ? SR_CHANNEL_ANALOG : SR_CHANNEL_LOGIC; - if (!(ch = sr_channel_new(i, chtype, TRUE, - mso19_channel_names[i]))) - return 0; + ch = sr_channel_new(i, chtype, TRUE, + mso19_channel_names[i]); sdi->channels = g_slist_append(sdi->channels, ch); }