From: Spencer Oliver Date: Mon, 13 Aug 2012 11:32:27 +0000 (+0100) Subject: target: catch dap_lookup read error X-Git-Tag: v0.6.0-rc2~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=78f4f9564881b1f81024b1f629a88c28436aecc4;p=openocd target: catch dap_lookup read error Issue found by clang-3.1 Change-Id: I2e922ec83117e75db5bec1e82edaa75a9e6e7464 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/778 Tested-by: jenkins Reviewed-by: Freddie Chopin --- diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index fd3a92ce..eed84ce9 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1265,6 +1265,8 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap, retval = mem_ap_read_atomic_u32(dap, (component_base & 0xfffff000) | 0xfcc, &devtype); + if (retval != ERROR_OK) + return retval; if ((devtype & 0xff) == type) { *addr = component_base; retval = ERROR_OK;