X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fvictor-dmm%2Fapi.c;h=f2e3d783bb4e816c81667e2434a197dccbe1a840;hb=61f2b7f74cd2d05cacb2bfb3cad2c2d67c856f47;hp=9fb508371939abc0a2609c05ff177c14e3355d14;hpb=5533392828cb08b2c6a008d6e2a52c7a01139f42;p=libsigrok.git diff --git a/src/hardware/victor-dmm/api.c b/src/hardware/victor-dmm/api.c index 9fb50837..f2e3d783 100644 --- a/src/hardware/victor-dmm/api.c +++ b/src/hardware/victor-dmm/api.c @@ -84,23 +84,19 @@ static GSList *scan(GSList *options) usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)); - sdi = sr_dev_inst_new(); + sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; sdi->vendor = g_strdup(VICTOR_VENDOR); sdi->driver = di; sdi->connection_id = g_strdup(connection_id); - - if (!(devc = g_try_malloc0(sizeof(struct dev_context)))) - return NULL; + devc = g_malloc0(sizeof(struct dev_context)); sdi->priv = devc; - 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(NULL, ch); - if (!(sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]), - libusb_get_device_address(devlist[i]), NULL))) - return NULL; + sdi->conn = sr_usb_dev_inst_new(libusb_get_bus_number(devlist[i]), + libusb_get_device_address(devlist[i]), NULL); sdi->inst_type = SR_INST_USB; drvc->instances = g_slist_append(drvc->instances, sdi);