From 2a25c968bf4ffec39ee76da0a164e46bd4215134 Mon Sep 17 00:00:00 2001 From: Øyvind Harboe Date: Fri, 18 Jun 2010 15:35:52 +0200 Subject: cortex a8: fix segfault for unexamined targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit print error message instead of segfaulting for unexamined targets. Signed-off-by: Øyvind Harboe --- src/target/cortex_a8.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/target/cortex_a8.c') diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index 0b12abe5..cfec48b6 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1839,10 +1839,13 @@ COMMAND_HANDLER(cortex_a8_handle_cache_info_command) COMMAND_HANDLER(cortex_a8_handle_dbginit_command) { struct target *target = get_current_target(CMD_CTX); + if (!target_was_examined(target)) + { + LOG_ERROR("target not examined yet"); + return ERROR_FAIL; + } - cortex_a8_init_debug_access(target); - - return ERROR_OK; + return cortex_a8_init_debug_access(target); } static const struct command_registration cortex_a8_exec_command_handlers[] = { -- cgit v1.2.3