shell: modules: devmem: use strtoul instead of strtol
All variables for address, width and value are unsigned, so use strtoul instead of strtol. This fixes an issue when 0xffffffff is about to be assigned to specific address, which was truncated to 0x7fffffff so far. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
parent
ce36a05953
commit
611a1ae51a
1 changed files with 3 additions and 3 deletions
|
@ -71,7 +71,7 @@ static int cmd_devmem(const struct shell *sh, size_t argc, char **argv)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
phys_addr = strtol(argv[1], NULL, 16);
|
||||
phys_addr = strtoul(argv[1], NULL, 16);
|
||||
|
||||
#if defined(CONFIG_MMU) || defined(CONFIG_PCIE)
|
||||
device_map((mm_reg_t *)&addr, phys_addr, 0x100, K_MEM_CACHE_NONE);
|
||||
|
@ -84,7 +84,7 @@ static int cmd_devmem(const struct shell *sh, size_t argc, char **argv)
|
|||
if (argc < 3) {
|
||||
width = 32;
|
||||
} else {
|
||||
width = strtol(argv[2], NULL, 10);
|
||||
width = strtoul(argv[2], NULL, 10);
|
||||
}
|
||||
|
||||
shell_fprintf(sh, SHELL_NORMAL, "Using data width %d\n", width);
|
||||
|
@ -97,7 +97,7 @@ static int cmd_devmem(const struct shell *sh, size_t argc, char **argv)
|
|||
* this value at the address provided
|
||||
*/
|
||||
|
||||
value = strtol(argv[3], NULL, 16);
|
||||
value = strtoul(argv[3], NULL, 16);
|
||||
|
||||
shell_fprintf(sh, SHELL_NORMAL, "Writing value 0x%lx\n", value);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue