summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-01-17 10:52:45 +0000
committerLeah Rowe <leah@libreboot.org>2023-01-17 10:52:45 +0000
commite398331b3804b7e7e8c61f6845e18beec7b23578 (patch)
tree7c960d43686bda7f8df6d8c9bb3713278e89eff2 /util
parent8dea350a625c8d8d9fc0835664b50c1e90ca6fd8 (diff)
util/nvmutil: make writeGbeFile more readable
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 4acef2fa..cf8c63d4 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -436,19 +436,19 @@ byteswap(uint8_t *byte)
void
writeGbeFile(int *fd, const char *filename)
{
- int partnum;
+ int p;
+ int nw = SIZE_4KB;
errno = 0;
- for (partnum = 0; partnum < 2; partnum++) {
- if (nvmPartModified[partnum]) {
- printf("Part %d modified\n", partnum);
+ for (p = 0; p < 2; p++) {
+ if (nvmPartModified[p]) {
+ printf("Part %d modified\n", p);
} else {
fprintf (stderr,
- "Part %d NOT modified\n", partnum);
+ "Part %d NOT modified\n", p);
continue;
}
- if (pwrite((*fd), (uint8_t *) gbe[partnum], SIZE_4KB,
- partnum << 12) != SIZE_4KB)
+ if (pwrite((*fd), (uint8_t *) gbe[p], nw, p << 12) != nw)
err(errno, "%s", filename);
}
if (close((*fd)))