From: Gerhard Sittig Date: Sun, 16 Jun 2019 09:13:15 +0000 (+0200) Subject: korad-kaxxxxp: silence compiler warning (unused value) X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=5dfa77b5 korad-kaxxxxp: silence compiler warning (unused value) 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?"); --- diff --git a/src/hardware/korad-kaxxxxp/protocol.c b/src/hardware/korad-kaxxxxp/protocol.c index 1407d51a..34763670 100644 --- a/src/hardware/korad-kaxxxxp/protocol.c +++ b/src/hardware/korad-kaxxxxp/protocol.c @@ -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();