From 2b948afb28d0674eebb4dc0ece088fbf95f6a142 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Thu, 21 Oct 2021 09:10:56 -0700 Subject: board_id: fix an incorrect offset calculation The INFO_BOARD_ID_OFFSET value includes the offset of the board ID field, there is no need to add the field offset again. This incorrect calculation is not a problem, because the offset of the 'bid' field is zero, but the logic is wrong. BUG=none TEST=board ID value is still reported properly. Signed-off-by: Vadim Bendebury Change-Id: I3e7061a930d751d2cf13113b1e519e8f976195bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3236754 Reviewed-by: Mary Ruthven Reviewed-by: Andrey Pronin --- chip/g/board_id.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chip/g/board_id.c b/chip/g/board_id.c index c7613dd3bd..cc2b7ebfaa 100644 --- a/chip/g/board_id.c +++ b/chip/g/board_id.c @@ -186,8 +186,7 @@ static int write_board_id(struct board_id *id) flash_info_write_enable(); /* Write Board ID */ - rv = flash_info_physical_write(INFO_BOARD_ID_OFFSET + - offsetof(struct info1_board_space, bid), + rv = flash_info_physical_write(INFO_BOARD_ID_OFFSET, sizeof(*id), (const char *)id); if (rv != EC_SUCCESS) CPRINTS("%s: write failed", __func__); -- cgit v1.2.1