scpi: avoid uninitialized use of a variable

The 'opc' variable was only conditionally assigned to (depends on
successful SCPI communication). Ensure there always is a known value.

This was reported by clang's scan-build.
This commit is contained in:
Gerhard Sittig 2018-02-08 22:08:54 +01:00 committed by Uwe Hermann
parent d3ec7035bc
commit da6f107eff
1 changed files with 1 additions and 0 deletions

View File

@ -651,6 +651,7 @@ SR_PRIV int sr_scpi_get_opc(struct sr_scpi_dev_inst *scpi)
gboolean opc; gboolean opc;
for (i = 0; i < SCPI_READ_RETRIES; i++) { for (i = 0; i < SCPI_READ_RETRIES; i++) {
opc = FALSE;
sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc); sr_scpi_get_bool(scpi, SCPI_CMD_OPC, &opc);
if (opc) if (opc)
return SR_OK; return SR_OK;