From: Gerhard Sittig Date: Sun, 16 Jun 2019 08:37:50 +0000 (+0200) Subject: dmm/bm86x: improve robustness of secondary display parsing X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=fbbbca843d43dd24b78160bc41826fa9d0c677b8;p=libsigrok.git dmm/bm86x: improve robustness of secondary display parsing 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, --- diff --git a/src/dmm/bm86x.c b/src/dmm/bm86x.c index ea260d8f..442e5cca 100644 --- a/src/dmm/bm86x.c +++ b/src/dmm/bm86x.c @@ -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) {