From 78f4f9564881b1f81024b1f629a88c28436aecc4 Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Mon, 13 Aug 2012 12:32:27 +0100 Subject: [PATCH] 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 --- src/target/arm_adi_v5.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index fd3a92ce3..eed84ce95 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;