X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fkecheng-kc-330b%2Fapi.c;h=86ac30b15a5dfd7f435129adf4cefde36b553441;hb=efa9840222f2925c187715377e3646679fd8496c;hp=15c43b1b95fa21c155165983e832754e67a2e727;hpb=e91bb0a6c4a94957e4e998ca134dc806bec49a7f;p=libsigrok.git diff --git a/src/hardware/kecheng-kc-330b/api.c b/src/hardware/kecheng-kc-330b/api.c index 15c43b1b..86ac30b1 100644 --- a/src/hardware/kecheng-kc-330b/api.c +++ b/src/hardware/kecheng-kc-330b/api.c @@ -163,15 +163,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) @@ -193,15 +188,9 @@ 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 dev_context *devc; struct sr_usb_dev_inst *usb; - if (!di->context) { - sr_err("Driver was not initialized."); - return SR_ERR; - } - usb = sdi->conn; if (!usb->devhdl) @@ -274,7 +263,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; uint64_t p, q; unsigned int i; @@ -286,11 +274,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; ret = SR_OK; switch (key) {