]> sigrok.org Git - libsigrok.git/commitdiff
dmm/bm86x: improve robustness of secondary display parsing
authorGerhard Sittig <redacted>
Sun, 16 Jun 2019 08:37:50 +0000 (10:37 +0200)
committerGerhard Sittig <redacted>
Sun, 21 Aug 2022 15:45:11 +0000 (17:45 +0200)
Return with unset MQ when parsing the number value for the secondary
display of BM86x fails. So that no invalid measurement result gets sent
to the session bus.

Reported-By: a helpful compiler warning
../src/dmm/bm86x.c:290:3: warning: Value stored to 'ret' is never read
                ret = brymen_bm86x_parse_digits(&buf[9], 4, txtbuf,

src/dmm/bm86x.c

index ea260d8f97180869cfa6441696be549a476323da..442e5cca038e2238dfc7c9f1ba41a943a5679856 100644 (file)
@@ -302,6 +302,8 @@ static void brymen_bm86x_parse(const uint8_t *buf, float *floatval,
                        NULL, &temp_unit, NULL, 0x80);
                ret = brymen_bm86x_parse_digits(&buf[9], 4, txtbuf,
                        floatval, NULL, &digits, 0x10);
+               if (ret != SR_OK)
+                       return;
 
                /* SI unit. */
                if (buf[14] & 0x08) {