]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
sr_dev_close(): Set status to SR_ST_INACTIVE.
[libsigrok.git] / src / hardware / scpi-pps / api.c
index 52b70d3e0adf5a6f582b23004e3ed312b20bf986..707d26263198c4f039c8d61b73e1a5ef49957325 100644 (file)
@@ -277,15 +277,15 @@ static int dev_close(struct sr_dev_inst *sdi)
 
        devc = sdi->priv;
        scpi = sdi->conn;
-       if (scpi) {
-               if (devc->beeper_was_set)
-                       scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE);
-               scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL);
-               sr_scpi_close(scpi);
-               sdi->status = SR_ST_INACTIVE;
-       }
 
-       return SR_OK;
+       if (!scpi)
+               return SR_ERR_BUG;
+
+       if (devc->beeper_was_set)
+               scpi_cmd(sdi, devc->device->commands, SCPI_CMD_BEEPER_ENABLE);
+       scpi_cmd(sdi, devc->device->commands, SCPI_CMD_LOCAL);
+
+       return sr_scpi_close(scpi);
 }
 
 static void clear_helper(void *priv)