summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-06 16:55:23 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-06 16:55:23 +0000
commit199dbad96dcec34afe150098e5807a744f8d42de (patch)
tree13b314669f9ac21015df621f71d144551900423a
parent9e32456c8caa870449f63f279cf5020b51e47d1c (diff)
util/nvmutil: tidy up set_mac_nib
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 4068c0c4..7500739d 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -408,13 +408,13 @@ set_mac_nib(int mac_pos, int nib)
mac[mac_pos + nib]);
/* If random, ensure that local/unicast bits are set */
- if (byte == 0 && nib == 1) {
- if ((mac[mac_pos + nib] == '?') ||
- (mac[mac_pos + nib] == 'x') ||
- (mac[mac_pos + nib] == 'X')) /* random */
- h = (h & 0xE) | 2; /* local, unicast */
- }
+ if (byte == 0 && nib == 1 &&
+ (mac[mac_pos + nib] == '?') ||
+ (mac[mac_pos + nib] == 'x') ||
+ (mac[mac_pos + nib] == 'X')) /* random */
+ h = (h & 0xE) | 2; /* local, unicast */
+ /* Store the new nibble as part of the new MAC address */
macbuf[byte >> 1] |= (uint16_t)h <<
(((byte & 1) << 3) + (4 * (nib ^ 1)));
}