util/nvmutil: tidy up rhex

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-03 15:43:11 +00:00
parent 403fd260b5
commit 572b7758cf
+8 -3
View File
@@ -340,9 +340,14 @@ hextonum(char ch)
static uint8_t
rhex(void)
{
static uint8_t n = 0, rnum[12];
if (!n)
err_if(read(rfd, (uint8_t *) &rnum, (n = 11) + 1) == -1);
static uint8_t n = 0;
static uint8_t rnum[12];
if (!n) {
n = sizeof(rnum) - 1;
err_if(read(rfd, (uint8_t *) &rnum, n + 1) == -1);
}
return rnum[n--] & 0xf;
}