X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-dmm%2Fapi.c;h=e1580b998df3914c4f260c58370dd8f04c175ce8;hb=61f2b7f74cd2d05cacb2bfb3cad2c2d67c856f47;hp=a69885d6cc46ca57052261723bfecaf537c498b1;hpb=8769478c0749a1a74a87a5476d6bfb9ef7e8f93f;p=libsigrok.git diff --git a/src/hardware/uni-t-dmm/api.c b/src/hardware/uni-t-dmm/api.c index a69885d6..e1580b99 100644 --- a/src/hardware/uni-t-dmm/api.c +++ b/src/hardware/uni-t-dmm/api.c @@ -252,28 +252,18 @@ static GSList *scan(GSList *options, int dmm) for (l = usb_devices; l; l = l->next) { usb = l->data; - - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) { - sr_err("Device context malloc failed."); - return NULL; - } - + devc = g_malloc0(sizeof(struct dev_context)); devc->first_run = TRUE; - - if (!(sdi = sr_dev_inst_new(SR_ST_INACTIVE, - udmms[dmm].vendor, udmms[dmm].device, NULL))) { - sr_err("sr_dev_inst_new returned NULL."); - return NULL; - } + sdi = g_malloc0(sizeof(struct sr_dev_inst)); + sdi->status = SR_ST_INACTIVE; + sdi->vendor = g_strdup(udmms[dmm].vendor); + sdi->model = g_strdup(udmms[dmm].device); sdi->priv = devc; sdi->driver = udmms[dmm].di; - if (!(ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1"))) - return NULL; + ch = sr_channel_new(0, SR_CHANNEL_ANALOG, TRUE, "P1"); sdi->channels = g_slist_append(sdi->channels, ch); - sdi->inst_type = SR_INST_USB; sdi->conn = usb; - drvc->instances = g_slist_append(drvc->instances, sdi); devices = g_slist_append(devices, sdi); }