Attention is currently required from: Arthur Heymans.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/68160 )
Change subject: util/cbfstool: Add a new mechanism to provide a memory mapped ......................................................................
Patch Set 1:
(2 comments)
File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/68160/comment/2ae7fab3_63c69a7b PS1, Line 313: // Should be enough for now Please be consistent with the existing C-style comments.
https://review.coreboot.org/c/coreboot/+/68160/comment/7c0535d6_7ce0ec9d PS1, Line 335: static int decode_mmap_arg(char *optarg) : { : if (optarg == NULL) : return 1; : : unsigned long flash_base; : unsigned long mmap_base; : unsigned long region_size; : char *suffix = NULL; : char *substring = strtok(optarg, ":"); : if (substring) : flash_base = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid flash base address '%s'.\n", : optarg); : return 1; : } : substring = strtok(NULL, ":"); : if (substring) : mmap_base = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid mmap base address '%s'.\n", : optarg); : return 1; : } : substring = strtok(NULL, ":"); : if (substring) : region_size = strtol(substring, &suffix, 0); : if (!substring || (suffix && *suffix)) { : ERROR("Invalid flash region size '%s'.\n", : optarg); : return 1; : } : : if (strtok(NULL, ":") != NULL) { : ERROR("Invalid argument, too many substrings '%s'.\n", : optarg); : : return 1; : } : : add_mmap_window(flash_base, mmap_base, region_size); : return 0;
This looks bad. […]
It doesn't look *too* bad, but please try introducing a helper function that gets called three times to read the three numbers.