From: OpenOCD-Gerrit <ope...@us...> - 2014-09-15 08:24:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 45f01e0a1269ceb23bfd3a34d2d635bf07463bd0 (commit) from 910972fcec5f6a575bfe2e1255420b873f5568c8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 45f01e0a1269ceb23bfd3a34d2d635bf07463bd0 Author: Andreas Fritiofson <and...@gm...> Date: Tue Sep 2 21:51:51 2014 +0200 cortex_m: Check return value from cortex_m_dcc_read. Caught by clang. Change-Id: I26d2b845aca431612862ef432b217ca397d9b893 Signed-off-by: Andreas Fritiofson <and...@gm...> Reviewed-on: http://openocd.zylin.com/2279 Tested-by: jenkins Reviewed-by: Spencer Oliver <sp...@sp...> diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index aafc097..72dbe9e 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -1910,7 +1910,9 @@ static int cortex_m_target_request_data(struct target *target, uint32_t i; for (i = 0; i < (size * 4); i++) { - cortex_m_dcc_read(target, &data, &ctrl); + int retval = cortex_m_dcc_read(target, &data, &ctrl); + if (retval != ERROR_OK) + return retval; buffer[i] = data; } @@ -1929,8 +1931,11 @@ static int cortex_m_handle_target_request(void *priv) if (target->state == TARGET_RUNNING) { uint8_t data; uint8_t ctrl; + int retval; - cortex_m_dcc_read(target, &data, &ctrl); + retval = cortex_m_dcc_read(target, &data, &ctrl); + if (retval != ERROR_OK) + return retval; /* check if we have data */ if (ctrl & (1 << 0)) { @@ -1938,12 +1943,12 @@ static int cortex_m_handle_target_request(void *priv) /* we assume target is quick enough */ request = data; - cortex_m_dcc_read(target, &data, &ctrl); - request |= (data << 8); - cortex_m_dcc_read(target, &data, &ctrl); - request |= (data << 16); - cortex_m_dcc_read(target, &data, &ctrl); - request |= (data << 24); + for (int i = 1; i <= 3; i++) { + retval = cortex_m_dcc_read(target, &data, &ctrl); + if (retval != ERROR_OK) + return retval; + request |= ((uint32_t)data << (i * 8)); + } target_request(target, request); } } ----------------------------------------------------------------------- Summary of changes: src/target/cortex_m.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |