]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hameg-hmo/api.c
sr_dev_clear(): Always free sdi->priv (devc).
[libsigrok.git] / src / hardware / hameg-hmo / api.c
index 7b5a71db1c42e3fa5075f2b730b5f4d4a3bb9bb8..7e062b8d6f258feb05989dc9571ec67e5298a665 100644 (file)
@@ -120,38 +120,27 @@ static void clear_helper(void *priv)
 
        g_free(devc->analog_groups);
        g_free(devc->digital_groups);
-
-       g_free(devc);
 }
 
 static int dev_clear(const struct sr_dev_driver *di)
 {
-       return std_dev_clear(di, clear_helper);
+       return std_dev_clear_with_callback(di, clear_helper);
 }
 
 static int dev_open(struct sr_dev_inst *sdi)
 {
-       if (sdi->status != SR_ST_ACTIVE && sr_scpi_open(sdi->conn) != SR_OK)
+       if (sr_scpi_open(sdi->conn) != SR_OK)
                return SR_ERR;
 
        if (hmo_scope_state_get(sdi) != SR_OK)
                return SR_ERR;
 
-       sdi->status = SR_ST_ACTIVE;
-
        return SR_OK;
 }
 
 static int dev_close(struct sr_dev_inst *sdi)
 {
-       if (sdi->status == SR_ST_INACTIVE)
-               return SR_OK;
-
-       sr_scpi_close(sdi->conn);
-
-       sdi->status = SR_ST_INACTIVE;
-
-       return SR_OK;
+       return sr_scpi_close(sdi->conn);
 }
 
 static int check_channel_group(struct dev_context *devc,