]> sigrok.org Git - libsigrok.git/commitdiff
zeroplus: Clip sampling sizes larger that our sample memory
authorRuss Dill <redacted>
Tue, 3 Dec 2013 05:57:46 +0000 (21:57 -0800)
committerBert Vermeulen <redacted>
Thu, 5 Dec 2013 00:09:51 +0000 (01:09 +0100)
Otherwise, we'll return a non-sensical result for our memory_size
enumeration.

hardware/zeroplus-logic-cube/protocol.c

index 470debe64e4a6e91d5a13ba08894fb703d17ca83..158b77cab6312c26f99ede655fd23db9ee92b0e6 100644 (file)
@@ -57,6 +57,9 @@ SR_PRIV int clz(unsigned int x)
 
 SR_PRIV int set_limit_samples(struct dev_context *devc, uint64_t samples)
 {
+       if (samples > devc->max_sample_depth)
+               samples = devc->max_sample_depth;
+
        devc->limit_samples = samples;
 
        if (samples <= 2 * 1024)