libpayload: fix compiler warning for first_cmos_entry()
The 'name' argument to lookup_cmos_entry() is declared to be 'char *'
but we pass an empty string ("") which is 'const char[]' so the compiler
legitimatly warns about discarded qualifiers here. Fix this by passing
NULL as 'name'.
Minor nitpick: The NULL test in lookup_cmos_entry() is superfluous as our
implementation of strnlen() can handle NULL pointers gracefully. But for
an average C hacker it just doesn't feel right not to do so.
Change-Id: I592917d12d8fa840804c0d19e38b844427064fef
Signed-off-by: Mathias Krause <mathias.krause@secunet.com>
Reviewed-on: http://review.coreboot.org/651
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
committed by
Stefan Reinauer
parent
f01291dd64
commit
632ab1ff65
@@ -155,7 +155,7 @@ static int set_cmos_value(const struct nvram_accessor *nvram, u32 bitnum, u32 le
|
|||||||
static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *option_table, char *name)
|
static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *option_table, char *name)
|
||||||
{
|
{
|
||||||
struct cb_cmos_entries *cmos_entry;
|
struct cb_cmos_entries *cmos_entry;
|
||||||
int len = strnlen(name, CMOS_MAX_NAME_LENGTH);
|
int len = name ? strnlen(name, CMOS_MAX_NAME_LENGTH) : 0;
|
||||||
|
|
||||||
/* cmos entries are located right after the option table */
|
/* cmos entries are located right after the option table */
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ static struct cb_cmos_entries *lookup_cmos_entry(struct cb_cmos_option_table *op
|
|||||||
|
|
||||||
struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table)
|
struct cb_cmos_entries *first_cmos_entry(struct cb_cmos_option_table *option_table)
|
||||||
{
|
{
|
||||||
return lookup_cmos_entry(option_table, "");
|
return lookup_cmos_entry(option_table, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cmos_entry)
|
struct cb_cmos_entries *next_cmos_entry(struct cb_cmos_entries *cmos_entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user