aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorMathias K <kesmtp@freenet.de>2011-11-29 09:37:44 +0100
committerØyvind Harboe <oyvindharboe@gmail.com>2011-11-29 14:35:24 +0000
commitea54ea5364b855ffc6d2733463308a63f9a8e307 (patch)
tree863d8fca98143515666bbd26690983d55a99951c /src/target
parentce3760c7e803824707e06615975d5a0d7684d26c (diff)
downloadriscv-openocd-ea54ea5364b855ffc6d2733463308a63f9a8e307.zip
riscv-openocd-ea54ea5364b855ffc6d2733463308a63f9a8e307.tar.gz
riscv-openocd-ea54ea5364b855ffc6d2733463308a63f9a8e307.tar.bz2
target init sanity check
Add a test if the pointer to the target_init function in the target struct is set before the function pointer is used. Change-Id: Ie4ea542f64f35efce8c5bce2ced9b881bf283ec1 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/241 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/target.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c
index bcd00a1..a414a6a 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -940,6 +940,8 @@ static int target_init_one(struct command_context *cmd_ctx,
if (type->check_reset== NULL)
type->check_reset = default_check_reset;
+ assert(type->init_target != NULL);
+
int retval = type->init_target(cmd_ctx, target);
if (ERROR_OK != retval)
{