From ea54ea5364b855ffc6d2733463308a63f9a8e307 Mon Sep 17 00:00:00 2001 From: Mathias K Date: Tue, 29 Nov 2011 09:37:44 +0100 Subject: [PATCH] target init sanity check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: http://openocd.zylin.com/241 Tested-by: jenkins Reviewed-by: Øyvind Harboe --- src/target/target.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/target/target.c b/src/target/target.c index bcd00a1fb..a414a6a7d 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) { -- 2.11.4.GIT