Browse Source

flash/xmc4xxx: use COMMAND_PARSE_NUMBER in command handlers

the usage of COMMAND_PARSE_NUMBER is safer in COMMAND_HANDLERs since it provides
better error checking than strto** functions.

Change-Id: Ibfe95ce73f147f467de8de23e9573ef0179aed96
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6421
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
jim
Tarek BOCHKATI 2 years ago
committed by Antonio Borneo
parent
commit
01da8f6c2a
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/flash/nor/xmc4xxx.c

+ 2
- 2
src/flash/nor/xmc4xxx.c View File

@@ -1268,12 +1268,12 @@ COMMAND_HANDLER(xmc4xxx_handle_flash_password_command)
errno = 0;

/* We skip over the flash bank */
fb->pw1 = strtol(CMD_ARGV[1], NULL, 16);
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], fb->pw1);

if (errno)
return ERROR_COMMAND_SYNTAX_ERROR;

fb->pw2 = strtol(CMD_ARGV[2], NULL, 16);
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], fb->pw2);

if (errno)
return ERROR_COMMAND_SYNTAX_ERROR;


Loading…
Cancel
Save