mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
UPSTREAM: 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.
BUG=none
BRANCH=none
TEST=none
Change-Id: I99768c9fee002d965c8e98e36f5d385f9e9cd861
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 0e7a93fa65
Original-Change-Id: Ieb4661aad7e4d640772325c3c6b184de1947edc3
Original-Signed-off-by: Martin Roth <martinroth@google.com>
Original-Reviewed-on: https://review.coreboot.org/18236
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Original-Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: https://chromium-review.googlesource.com/433882
This commit is contained in:
parent
199aa7bfe9
commit
aafaff5d06
1 changed files with 4 additions and 4 deletions
|
@ -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…
Add table
Reference in a new issue