X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Funi-t-ut32x%2Fapi.c;h=7ed3f88ce8fa1f38d8b159584d92224b02357298;hb=efa9840222f2925c187715377e3646679fd8496c;hp=f19dabeff55015f0bad2d20de530650b8821aec5;hpb=e91bb0a6c4a94957e4e998ca134dc806bec49a7f;p=libsigrok.git diff --git a/src/hardware/uni-t-ut32x/api.c b/src/hardware/uni-t-ut32x/api.c index f19dabef..7ed3f88c 100644 --- a/src/hardware/uni-t-ut32x/api.c +++ b/src/hardware/uni-t-ut32x/api.c @@ -101,15 +101,10 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options) static int dev_open(struct sr_dev_inst *sdi) { struct sr_dev_driver *di = sdi->driver; - struct drv_context *drvc; + struct drv_context *drvc = di->context; struct sr_usb_dev_inst *usb; int ret; - if (!(drvc = di->context)) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - usb = sdi->conn; if (sr_usb_open(drvc->sr_ctx->libusb_ctx, usb) != SR_OK) @@ -145,14 +140,8 @@ static int dev_open(struct sr_dev_inst *sdi) static int dev_close(struct sr_dev_inst *sdi) { - struct sr_dev_driver *di = sdi->driver; struct sr_usb_dev_inst *usb; - if (!di->context) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - usb = sdi->conn; if (!usb->devhdl) /* Nothing to do. */ @@ -194,7 +183,6 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi, const struct sr_channel_group *cg) { - struct sr_dev_driver *di = sdi->driver; struct dev_context *devc; const char *tmp_str; @@ -203,11 +191,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd if (sdi->status != SR_ST_ACTIVE) return SR_ERR_DEV_CLOSED; - if (!di->context) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - devc = sdi->priv; switch (key) {