]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/fx2lafw/api.c
Check usb_get_port_path() return value
[libsigrok.git] / src / hardware / fx2lafw / api.c
index a2de010a27defc3464fb7f0188093fe2aaa9d48f..647aeec04d35522c11ba2cf80bec6899629b0a82 100644 (file)
@@ -263,10 +263,11 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                        continue;
                }
 
-               usb_get_port_path(devlist[i], connection_id, sizeof(connection_id));
-
                libusb_close(hdl);
 
+               if (usb_get_port_path(devlist[i], connection_id, sizeof(connection_id)) < 0)
+                       continue;
+
                prof = NULL;
                for (j = 0; supported_fx2[j].vid; j++) {
                        if (des.idVendor == supported_fx2[j].vid &&
@@ -540,6 +541,8 @@ static int config_list(uint32_t key, GVariant **data,
        case SR_CONF_DEVICE_OPTIONS:
                return STD_CONFIG_LIST(key, data, sdi, cg, scanopts, drvopts, devopts);
        case SR_CONF_SAMPLERATE:
+               if (!devc)
+                       return SR_ERR_NA;
                *data = std_gvar_samplerates(devc->samplerates, devc->num_samplerates);
                break;
        case SR_CONF_TRIGGER_MATCH: