]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/beaglelogic/api.c
sr_dev_close(): Factor out SR_ERR_DEV_CLOSED check.
[libsigrok.git] / src / hardware / beaglelogic / api.c
index 734f477f9f62cdb48d42fac7febfffda71d78265..0d022f2b336967e0aea956071d21ca92589c55eb 100644 (file)
@@ -166,12 +166,12 @@ static int dev_close(struct sr_dev_inst *sdi)
 {
        struct dev_context *devc = sdi->priv;
 
-       if (sdi->status == SR_ST_ACTIVE) {
-               /* Close the memory mapping and the file */
-               beaglelogic_munmap(devc);
-               beaglelogic_close(devc);
-       }
+       /* Close the memory mapping and the file */
+       beaglelogic_munmap(devc);
+       beaglelogic_close(devc);
+
        sdi->status = SR_ST_INACTIVE;
+
        return SR_OK;
 }
 
@@ -210,9 +210,6 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
 
        (void)cg;
 
-       if (sdi->status != SR_ST_ACTIVE)
-               return SR_ERR_DEV_CLOSED;
-
        switch (key) {
        case SR_CONF_SAMPLERATE:
                devc->cur_samplerate = g_variant_get_uint64(data);