cortex_m: Check return value from cortex_m_dcc_read.

Caught by clang.

Change-Id: I26d2b845aca431612862ef432b217ca397d9b893
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2279
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
Andreas Fritiofson 2014-09-02 21:51:51 +02:00 committed by Spencer Oliver
parent 910972fcec
commit 45f01e0a12
1 changed files with 13 additions and 8 deletions

View File

@ -1910,7 +1910,9 @@ static int cortex_m_target_request_data(struct target *target,
uint32_t i; uint32_t i;
for (i = 0; i < (size * 4); 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; buffer[i] = data;
} }
@ -1929,8 +1931,11 @@ static int cortex_m_handle_target_request(void *priv)
if (target->state == TARGET_RUNNING) { if (target->state == TARGET_RUNNING) {
uint8_t data; uint8_t data;
uint8_t ctrl; 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 */ /* check if we have data */
if (ctrl & (1 << 0)) { if (ctrl & (1 << 0)) {
@ -1938,12 +1943,12 @@ static int cortex_m_handle_target_request(void *priv)
/* we assume target is quick enough */ /* we assume target is quick enough */
request = data; request = data;
cortex_m_dcc_read(target, &data, &ctrl); for (int i = 1; i <= 3; i++) {
request |= (data << 8); retval = cortex_m_dcc_read(target, &data, &ctrl);
cortex_m_dcc_read(target, &data, &ctrl); if (retval != ERROR_OK)
request |= (data << 16); return retval;
cortex_m_dcc_read(target, &data, &ctrl); request |= ((uint32_t)data << (i * 8));
request |= (data << 24); }
target_request(target, request); target_request(target, request);
} }
} }