Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52207 )
Change subject: mb/prodrive/hermes: Fix eeprom reading ......................................................................
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 --- M src/mainboard/prodrive/hermes/eeprom.c 1 file changed, 2 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/52207/1
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index 6f61b30..8d2c056 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -121,10 +121,8 @@
/* 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]; + const size_t bytes_to_copy = size >= 2 ? 2 : 1; + memcpy(writePointer, tmp, bytes_to_copy); }
/* Restore I2C_EN bit */