summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-04-09 11:18:52 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-04-10 20:23:24 +0000
commitaf13a6ed286a94543b22a232d99577d91d6c235f (patch)
tree3b7fda9657a73f39cffc0d4db1e629d4505fb6f6
parentfce0954f456d05f2cb7200eb9508710c1801c9f6 (diff)
mb/prodrive/hermes: Fix eeprom reading
The logic for bytes to copy to the function input pointer was wrong. What it did was to loop over all 2 bytes that need to be read and only copy the first byte. Change-Id: Ic08cf01d800babd4a9176dfb2337411b789040f3 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52207 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Christian Walter <christian.walter@9elements.com>
-rw-r--r--src/mainboard/prodrive/hermes/eeprom.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c
index 6f61b30424..a712156bc1 100644
--- a/src/mainboard/prodrive/hermes/eeprom.c
+++ b/src/mainboard/prodrive/hermes/eeprom.c
@@ -121,10 +121,9 @@ bool read_write_config(void *blob, size_t read_offset, size_t write_offset, size
/* Write to UPD */
uint8_t *writePointer = (uint8_t *)blob + write_offset + i;
- if (size > 1 && (size % 2 == 0))
- memcpy(writePointer, tmp, 2);
- else
- *writePointer = tmp[0];
+ writePointer[0] = tmp[0];
+ if (size - i > 1)
+ writePointer[1] = tmp[1];
}
/* Restore I2C_EN bit */