pld/virtex2: check error propagated by virtex2_read_stat()
Commit dd9137dc0e
("pld/virtex2: add missing error checks") adds
checks on the return value of several functions, allowing also
virtex2_read_stat() to propagate such returned values.
This triggers an error with clang, as it is now able to identify a
possible execution path that makes uninitialized the variable
status.
Check for the returned value of virtex2_read_stat() before using
the variable status and propagate the returned value.
While there, drop a useless empty string.
Change-Id: I7a23d3f904d4e07cdb6f6dfdf1179889b6b8afb8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7657
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
parent
f20173a01f
commit
3c2cc6efb8
|
@ -241,9 +241,13 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtex2_read_stat(device, &status);
|
int retval = virtex2_read_stat(device, &status);
|
||||||
|
if (retval != ERROR_OK) {
|
||||||
|
command_print(CMD, "cannot read virtex2 status register");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
command_print(CMD, "virtex2 status register: 0x%8.8" PRIx32 "", status);
|
command_print(CMD, "virtex2 status register: 0x%8.8" PRIx32, status);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue