diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2020-05-13 00:47:17 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2020-05-24 21:36:38 +0100 |
commit | 80e8b019b0757ae895783dc7b8eaf424a6f6428c (patch) | |
tree | 9820ddbcf6f1527efe92a947693fc164a040711e | |
parent | 3008756604b8b7a3811948cf66ed7e587efac349 (diff) | |
download | riscv-openocd-80e8b019b0757ae895783dc7b8eaf424a6f6428c.zip riscv-openocd-80e8b019b0757ae895783dc7b8eaf424a6f6428c.tar.gz riscv-openocd-80e8b019b0757ae895783dc7b8eaf424a6f6428c.tar.bz2 |
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 <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5661
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
-rw-r--r-- | src/helper/command.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/helper/command.c b/src/helper/command.c index 14746a0..193867f 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; } |