]> sigrok.org Git - libsigrok.git/commitdiff
korad-kaxxxxp: silence compiler warning (unused value)
authorGerhard Sittig <redacted>
Sun, 16 Jun 2019 09:13:15 +0000 (11:13 +0200)
committerGerhard Sittig <redacted>
Sun, 21 Aug 2022 15:45:11 +0000 (17:45 +0200)
Do inspect the return value of the routine which sends the command
before retrieving the response. This silences the following warnings:

../src/hardware/korad-kaxxxxp/protocol.c:179:3: warning: Value stored to 'ret' is never read
                ret = korad_kaxxxxp_send_cmd(serial, "IOUT1?");
../src/hardware/korad-kaxxxxp/protocol.c:184:3: warning: Value stored to 'ret' is never read
                ret = korad_kaxxxxp_send_cmd(serial, "ISET1?");
../src/hardware/korad-kaxxxxp/protocol.c:189:3: warning: Value stored to 'ret' is never read
                ret = korad_kaxxxxp_send_cmd(serial, "VOUT1?");
../src/hardware/korad-kaxxxxp/protocol.c:194:3: warning: Value stored to 'ret' is never read
                ret = korad_kaxxxxp_send_cmd(serial, "VSET1?");
../src/hardware/korad-kaxxxxp/protocol.c:202:3: warning: Value stored to 'ret' is never read
                ret = korad_kaxxxxp_send_cmd(serial, "STATUS?");

src/hardware/korad-kaxxxxp/protocol.c

index 1407d51a6d80804fdc75d52d2abd5a2a6984cbfe..3476367015fa0bdb049aace24979ba1bc46b7d5b 100644 (file)
@@ -297,8 +297,11 @@ SR_PRIV int korad_kaxxxxp_get_value(struct sr_serial_dev_inst *serial,
                break;
        default:
                sr_err("Don't know how to query %d.", target);
+               ret = SR_ERR;
+       }
+       if (ret != SR_OK) {
                g_mutex_unlock(&devc->rw_mutex);
-               return SR_ERR;
+               return ret;
        }
 
        devc->req_sent_at = g_get_monotonic_time();