From 70fee9207b5fd1c6f499b790591446adc4d4467c Mon Sep 17 00:00:00 2001 From: Øyvind Harboe Date: Mon, 19 Jul 2010 08:45:45 +0200 Subject: arm: add error propagation to generic get_ttb fn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- src/target/arm720t.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/target/arm720t.c') diff --git a/src/target/arm720t.c b/src/target/arm720t.c index 0ea6cb2b..b269f948 100644 --- a/src/target/arm720t.c +++ b/src/target/arm720t.c @@ -134,16 +134,24 @@ static int arm720t_write_cp15(struct target *target, uint32_t opcode, uint32_t v return ERROR_OK; } -static uint32_t arm720t_get_ttb(struct target *target) +static int arm720t_get_ttb(struct target *target, uint32_t *result) { uint32_t ttb = 0x0; - arm720t_read_cp15(target, 0xee120f10, &ttb); - jtag_execute_queue(); + int retval; + + retval = arm720t_read_cp15(target, 0xee120f10, &ttb); + if (retval != ERROR_OK) + return retval; + retval = jtag_execute_queue(); + if (retval != ERROR_OK) + return retval; ttb &= 0xffffc000; - return ttb; + *result = ttb; + + return ERROR_OK; } static void arm720t_disable_mmu_caches(struct target *target, -- cgit v1.2.3