From 80e8b019b0757ae895783dc7b8eaf424a6f6428c Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Wed, 13 May 2020 00:47:17 +0200 Subject: [PATCH] helper/command: fix check on value returned by jim API Either Jim_CreateCommand() and register_command_handler() return the jim error code JIM_OK/JIM_ERR. Fix the check and the initialization of retval. Change-Id: I3073c66764670128706ad979a43bb3edbbeb0ab0 Signed-off-by: Antonio Borneo Reviewed-on: http://openocd.zylin.com/5661 Reviewed-by: Andreas Fritiofson Tested-by: jenkins --- src/helper/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helper/command.c b/src/helper/command.c index 14746a0958..193867fe8c 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -380,14 +380,14 @@ struct command *register_command(struct command_context *context, if (NULL == c) return NULL; - int retval = ERROR_OK; + int retval = JIM_OK; if (NULL != cr->jim_handler && NULL == parent) { retval = Jim_CreateCommand(context->interp, cr->name, cr->jim_handler, NULL, NULL); } else if (NULL != cr->handler || NULL != parent) retval = register_command_handler(context, command_root(c)); - if (ERROR_OK != retval) { + if (retval != JIM_OK) { unregister_command(context, parent, name); c = NULL; } -- 2.30.2