summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-01-29 03:47:20 +0000
committerLeah Rowe <leah@libreboot.org>2025-01-29 03:47:20 +0000
commit96356ce94f66ee55a35d40e2098ebb9bfba173c7 (patch)
treec4588a99d74bd8e36e1931c9bf1598ab92679559
parentb1d8975959dc942bb8691253f3599e4ac99932eb (diff)
util/nvmutil: move "e" to swap()
we only use it there, so we should only define it there. it's used to detect host CPU endianness. Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 5ee990f2..0576167f 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -38,7 +38,7 @@ uint16_t mac[3] = {0, 0, 0};
ssize_t nf;
size_t partsize, gbe[2];
uint8_t nvmPartChanged[2] = {0, 0}, do_read[2] = {1, 1};
-int e = 1, flags, rfd, fd, part;
+int flags, rfd, fd, part;
const char *strMac = NULL, *strRMac = "??:??:??:??:??:??", *filename = NULL;
@@ -498,6 +498,7 @@ swap(int partnum) /* swaps bytes in words, not pointers. */
{ /* not to be confused with cmd_swap */
size_t w, x;
uint8_t *n = (uint8_t *) gbe[partnum];
+ int e = 1;
for (w = NVM_SIZE * ((uint8_t *) &e)[0], x = 1; w < NVM_SIZE;
w += 2, x += 2) {