target: catch dap_lookup read error
authorSpencer Oliver <spen@spen-soft.co.uk>
Mon, 13 Aug 2012 11:32:27 +0000 (12:32 +0100)
committerFreddie Chopin <freddie.chopin@gmail.com>
Fri, 24 Aug 2012 16:50:43 +0000 (16:50 +0000)
Issue found by clang-3.1

Change-Id: I2e922ec83117e75db5bec1e82edaa75a9e6e7464
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/778
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
src/target/arm_adi_v5.c

index fd3a92c..eed84ce 100644 (file)
@@ -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;