diff options
author | Hsuan Ting Chen <roccochen@chromium.org> | 2023-07-06 14:15:31 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-07-07 13:56:42 +0000 |
commit | 8f4b015759cf6189d8f942d7c06bea6a42a06c54 (patch) | |
tree | 01ece6d60b9ddd21d983771eb84509ad9aaad972 /src | |
parent | 908be4f6edd27ef84ceb904912b92656258a88c0 (diff) |
lib: Adjust the log levels in ux_locales.c
The function ux_locales_get_text() should expect to have a correct
preram_locales region to read, hence we need to adjust the log levels
inside lib/ux_locales.c:ux_locales_get_text():
* If the region does not exist or is not in a correct format, we should
print in BIOS_ERR
* If the arguments are not correct but we have a good workaround (e.g.
the lang_id from vboot API seems weird), we should print in
BIOS_WARNING.
Also change some minor syntax issues.
BUG=b:264666392, b:289995591
BRANCH=brya
TEST=emerge-brya coreboot chromeos-bootimage
Signed-off-by: Hsuan Ting Chen <roccochen@chromium.org>
Change-Id: Ic8a8856c883f6ca78fed69542a7d388f57c5c508
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76316
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ux_locales.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/ux_locales.c b/src/lib/ux_locales.c index 0ba66ad8cc..86126195b4 100644 --- a/src/lib/ux_locales.c +++ b/src/lib/ux_locales.c @@ -106,7 +106,7 @@ const char *ux_locales_get_text(const char *name) data = locales_get_map(&size, false); if (!data) { - printk(BIOS_INFO, "%s: %s not found.\n", __func__, + printk(BIOS_ERR, "%s: %s not found.\n", __func__, PRERAM_LOCALES_NAME); return NULL; } @@ -115,7 +115,7 @@ const char *ux_locales_get_text(const char *name) lang_id = vb2api_get_locale_id(vboot_get_context()); /* Validity check: Language ID should smaller than LANG_ID_MAX. */ if (lang_id >= LANG_ID_MAX) { - printk(BIOS_INFO, "%s: ID %d too big; fallback to 0.\n", + printk(BIOS_WARNING, "%s: ID %d too big; fallback to 0.\n", __func__, lang_id); lang_id = 0; } @@ -123,11 +123,10 @@ const char *ux_locales_get_text(const char *name) printk(BIOS_INFO, "%s: Search for %s with language ID: %u\n", __func__, name, lang_id); - offset = 0; /* Search for name. */ - offset = search_for(data, offset, size, name); + offset = search_for(data, 0, size, name); if (offset >= size) { - printk(BIOS_INFO, "%s: Name %s not found.\n", __func__, name); + printk(BIOS_ERR, "%s: Name %s not found.\n", __func__, name); return NULL; } name_offset = offset; @@ -145,20 +144,20 @@ const char *ux_locales_get_text(const char *name) if (lang_id != 0) offset = search_for_id(data, name_offset, size, 0); if (offset >= size) { - printk(BIOS_INFO, "%s: Neither %d nor 0 found.\n", + printk(BIOS_ERR, "%s: Neither %d nor 0 found.\n", __func__, lang_id); return NULL; } } - offset = move_next(data, offset, size); + offset = move_next(data, offset, size); if (offset >= size) return NULL; /* Validity check that the returned string must be NULL terminated. */ next = move_next(data, offset, size) - 1; if (next >= size || data[next] != '\0') { - printk(BIOS_INFO, "%s: %s is not NULL terminated.\n", + printk(BIOS_ERR, "%s: %s is not NULL terminated.\n", __func__, PRERAM_LOCALES_NAME); return NULL; } |