From af13a6ed286a94543b22a232d99577d91d6c235f Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Fri, 9 Apr 2021 11:18:52 +0200 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52207 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Christian Walter --- src/mainboard/prodrive/hermes/eeprom.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mainboard/prodrive') 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 */ -- cgit v1.2.3