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>
This commit is contained in:
parent
908be4f6ed
commit
8f4b015759
|
@ -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,7 +144,7 @@ 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;
|
||||
}
|
||||
|
@ -158,7 +157,7 @@ const char *ux_locales_get_text(const char *name)
|
|||
/* 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue