drivers/pc80/rtc: Check cmos checksum BEFORE reading cmos value
If cmos is invalid, it doesn't make sense to read the value before finding that out. Change-Id: Ieb4661aad7e4d640772325c3c6b184de1947edc3 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/18236 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
parent
0117924159
commit
0e7a93fa65
|
@ -251,14 +251,14 @@ enum cb_err get_option(void *dest, const char *name)
|
|||
return CB_CMOS_OPTION_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (get_cmos_value(ce->bit, ce->length, dest) != CB_SUCCESS) {
|
||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
||||
return CB_CMOS_ACCESS_ERROR;
|
||||
}
|
||||
if (!cmos_checksum_valid(LB_CKS_RANGE_START, LB_CKS_RANGE_END, LB_CKS_LOC)) {
|
||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
||||
return CB_CMOS_CHECKSUM_INVALID;
|
||||
}
|
||||
if (get_cmos_value(ce->bit, ce->length, dest) != CB_SUCCESS) {
|
||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
||||
return CB_CMOS_ACCESS_ERROR;
|
||||
}
|
||||
UNLOCK_NVRAM_CBFS_SPINLOCK();
|
||||
return CB_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue