[coreboot-gerrit] Patch set updated for coreboot: 7ab7676 baytrail: nvm: use proper types for checking erase

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Wed May 14 15:57:29 CEST 2014


Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5044

-gerrit

commit 7ab767673e4073ef9f80c209ff4ad5f2ce51b222
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Mon Jan 13 11:39:04 2014 -0600

    baytrail: nvm: use proper types for checking erase
    
    The current byte value was being converted to an int
    when checking against literal 0xff. As the type of
    the current pointer was char (signed) it was sign
    extending the value leading to 0xffffffff != 0xff.
    Fix this by using an unsigned type and using a
    constant type for expected erase value.
    
    BUG=chrome-os-partner:24916
    BRANCH=baytrail
    TEST=Booted after chromeos-firmwareupdate. Noted that MRC
         cache doesn't think the erased region isn't erased.
    
    Change-Id: If95425fe26da050acb25f52bea060e288ad3633c
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    Reviewed-on: https://chromium-review.googlesource.com/182154
    Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/soc/intel/baytrail/nvm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/soc/intel/baytrail/nvm.c b/src/soc/intel/baytrail/nvm.c
index dccc801..843bc5a 100644
--- a/src/soc/intel/baytrail/nvm.c
+++ b/src/soc/intel/baytrail/nvm.c
@@ -54,10 +54,11 @@ static inline uint32_t to_flash_offset(void *p)
 
 int nvm_is_erased(const void *start, size_t size)
 {
-	const char *cur = start;
+	const uint8_t *cur = start;
+	const uint8_t erased_value = 0xff;
 
 	while (size > 0) {
-		if (*cur != 0xff)
+		if (*cur != erased_value)
 			return 0;
 		cur++;
 		size--;



More information about the coreboot-gerrit mailing list