]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/chronovu-la/api.c
uni-t-ut181a: silence compiler warning, use of uninitialized variable
[libsigrok.git] / src / hardware / chronovu-la / api.c
index 3d19b4f06941ce4b20f51a4b6d63a3d0b387651e..694bd54ac84fb91f0f864cefa67d9d31eb2a641c 100644 (file)
@@ -192,10 +192,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;
+
                if (!strcmp(product, "ChronoVu LA8"))
                        model = 0;
                else if (!strcmp(product, "ChronoVu LA16"))
@@ -351,12 +352,12 @@ static int config_list(uint32_t key, GVariant **data,
                *data = std_gvar_samplerates(ARRAY_AND_SIZE(devc->samplerates));
                break;
        case SR_CONF_LIMIT_SAMPLES:
-               if (!devc->prof)
+               if (!devc || !devc->prof)
                        return SR_ERR_BUG;
                *data = std_gvar_tuple_u64(0, (devc->prof->model == CHRONOVU_LA8) ? MAX_NUM_SAMPLES : MAX_NUM_SAMPLES / 2);
                break;
        case SR_CONF_TRIGGER_MATCH:
-               if (!devc->prof)
+               if (!devc || !devc->prof)
                        return SR_ERR_BUG;
                *data = std_gvar_array_i32(trigger_matches, devc->prof->num_trigger_matches);
                break;