]> sigrok.org Git - libsigrok.git/blobdiff - hardware/brymen-dmm/api.c
hw_dev_close(): Move common checks to wrapper.
[libsigrok.git] / hardware / brymen-dmm / api.c
index b1b3acb929ea21c25d90c0c7387bbe4063de74e2..7d60fd031bbf553e1f87c5f8c0fba7e7da2b0300 100644 (file)
@@ -172,11 +172,7 @@ static GSList *hw_scan(GSList *options)
 
 static GSList *hw_dev_list(void)
 {
-       struct drv_context *drvc;
-
-       drvc = di->priv;
-
-       return drvc->instances;
+       return ((struct drv_context *)(di->priv))->instances;
 }
 
 static int hw_dev_open(struct sr_dev_inst *sdi)
@@ -200,10 +196,7 @@ static int hw_dev_close(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
-       if (!(devc = sdi->priv)) {
-               sr_err("sdi->priv was NULL.");
-               return SR_ERR_BUG;
-       }
+       devc = sdi->priv;
 
        if (devc->serial && devc->serial->fd != -1) {
                serial_close(devc->serial);