drivers/pc80/rtc/option.c: Constrain API to integer values
None of the options accessed within coreboot is a string, and there are no guarantees that the code works as intended with them. Given that the current option API only supports integers for now, do not try to access options whose type is 's' (string). Change-Id: Ib67b126d972c6d55b77ea5ecfb862b4e9c766fe5 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/52637 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
@@ -7,13 +7,13 @@
|
||||
|
||||
void sanitize_cmos(void);
|
||||
|
||||
enum cb_err cmos_set_option(const char *name, void *val);
|
||||
enum cb_err cmos_get_option(void *dest, const char *name);
|
||||
enum cb_err cmos_set_uint_option(const char *name, unsigned int *value);
|
||||
enum cb_err cmos_get_uint_option(unsigned int *dest, const char *name);
|
||||
|
||||
static inline enum cb_err set_uint_option(const char *name, unsigned int value)
|
||||
{
|
||||
if (CONFIG(USE_OPTION_TABLE))
|
||||
return cmos_set_option(name, &value);
|
||||
return cmos_set_uint_option(name, &value);
|
||||
|
||||
return CB_CMOS_OTABLE_DISABLED;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ static inline int get_uint_option(const char *name, const unsigned int fallback)
|
||||
{
|
||||
if (CONFIG(USE_OPTION_TABLE)) {
|
||||
unsigned int value = 0;
|
||||
if (cmos_get_option(&value, name) == CB_SUCCESS)
|
||||
if (cmos_get_uint_option(&value, name) == CB_SUCCESS)
|
||||
return value;
|
||||
}
|
||||
return fallback;
|
||||
|
Reference in New Issue
Block a user