aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2020-03-13 15:13:21 +0100
committerOleksij Rempel <linux@rempel-privat.de>2020-04-20 18:26:33 +0100
commit6dcd255b7bde5d7d3a8805c3a0e81f5edf42ccf4 (patch)
treef24bcaba9e4c105e7d20fcc382c3e0b6f63c9d83
parentc0644401622d1d5bf42e522452c7c9f83293cfd8 (diff)
downloadriscv-openocd-6dcd255b7bde5d7d3a8805c3a0e81f5edf42ccf4.zip
riscv-openocd-6dcd255b7bde5d7d3a8805c3a0e81f5edf42ccf4.tar.gz
riscv-openocd-6dcd255b7bde5d7d3a8805c3a0e81f5edf42ccf4.tar.bz2
jtag/drivers/ulink: fix clang static analyzer warning
scan-build-9: Description: Access to field 'payload_in' results in a dereference of a null pointer (loaded from field 'queue_start') File: src/jtag/drivers/ulink.c Line: 2216 Set input/output_signals conditionally if ulink_append_get_signals_cmd() and ulink_execute_queued_commands() returns no error. Do not fail driver initialisation as the signals are only printed. Change-Id: I6c842f0e9a604712abf7444a2fa95ba5810de1ff Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5520 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
-rw-r--r--src/jtag/drivers/ulink.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index 9235eb8..4066d61 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -2210,14 +2210,17 @@ static int ulink_init(void)
}
ulink_clear_queue(ulink_handle);
- ulink_append_get_signals_cmd(ulink_handle);
- ulink_execute_queued_commands(ulink_handle, 200);
+ ret = ulink_append_get_signals_cmd(ulink_handle);
+ if (ret == ERROR_OK)
+ ret = ulink_execute_queued_commands(ulink_handle, 200);
- /* Post-process the single CMD_GET_SIGNALS command */
- input_signals = ulink_handle->queue_start->payload_in[0];
- output_signals = ulink_handle->queue_start->payload_in[1];
+ if (ret == ERROR_OK) {
+ /* Post-process the single CMD_GET_SIGNALS command */
+ input_signals = ulink_handle->queue_start->payload_in[0];
+ output_signals = ulink_handle->queue_start->payload_in[1];
- ulink_print_signal_states(input_signals, output_signals);
+ ulink_print_signal_states(input_signals, output_signals);
+ }
ulink_clear_queue(ulink_handle);