]> sigrok.org Git - libsigrok.git/blobdiff - src/scpi/scpi.c
scpi: Move closing of discovered devices to sr_scpi_scan_resource().
[libsigrok.git] / src / scpi / scpi.c
index 0efde8bab7b9c11f8d2cec00ee48f1afd0ecac4f..c3c2f7130e5c14d00a0eef3ed0af90be5bd89d50 100644 (file)
@@ -110,12 +110,16 @@ static struct sr_dev_inst *sr_scpi_scan_resource(struct drv_context *drvc,
                return NULL;
        };
 
-       if ((sdi = probe_device(scpi)))
-               return sdi;
+       sdi = probe_device(scpi);
 
        sr_scpi_close(scpi);
-       sr_scpi_free(scpi);
-       return NULL;
+
+       if (sdi)
+               sdi->status = SR_ST_INACTIVE;
+       else
+               sr_scpi_free(scpi);
+
+       return sdi;
 }
 
 SR_PRIV GSList *sr_scpi_scan(struct drv_context *drvc, GSList *options,