Attention is currently required from: Nico Huber, Paul Menzel, Edward O'Callaghan, Angel Pons, Sergii Dmytruk. Anastasia Klimchuk has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/58738 )
Change subject: cli_classic: add writeprotect CLI ......................................................................
Patch Set 18:
(2 comments)
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58738/comment/4b0e52e1_6e8ef603 PS15, Line 66: " --wp-range=<start>,<len> set write protect range\n" : " --wp-region <region> set write protect region\n"
You unset it by setting an empty range (it's included in --wp-list), --wp-disable doesn't change the […]
Cool thanks! Your explanation: "You unset it by setting an empty range (it's included in --wp-list)"
seems like a great addition to command line help! My intention is that people can answer the question "how do I unset" just by reading help, without looking into the source code.
File cli_classic.c:
https://review.coreboot.org/c/flashrom/+/58738/comment/bcce3e99_4c234454 PS17, Line 220: ret = flashrom_wp_set_range(flash, &cfg, &range); : if (ret) { : msg_gerr("The chip does not support the requested range.\n"); : return ret; : } : : /* Write range before other operations (i.e. enabling HW protection) */ : ret = write_wp_config(flash, &cfg); : if (ret) : return ret;
The structure of the API is: […]
It's good to know there is no harm, but is there any effect of doing 1,2 without 3? What would be the most common usage, 1-2-3 or 1-2? If 1-2 is the most common usage then code is fine.
I don't suggest to ignore errors from the library, of course not. Errors should be checked in the same way, after every call. But they can be checked without printing a message. If `flashrom_wp_set_range` returns error, then just return 2 (or something else) without calling `write_wp_config`.
Just to be clear: I was thinking of a function like `mega_flashrom_wp_set_range` which does 1-2-3 and checks errors on every step.