[PATCH v2 1/1] lib: smbios: remove redundant next_header()
Heinrich Schuchardt
xypron.glpk at gmx.de
Sat Dec 23 02:17:33 CET 2023
next_header() and get_next_header() only differ in how the const attribute
is used. One function taking a const parameter and returning a non-const is
good enough.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
v2:
remove Fixes tag as the code redundancy is not an actual bug
---
lib/smbios-parser.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/lib/smbios-parser.c b/lib/smbios-parser.c
index b578c30840..f4de350e6e 100644
--- a/lib/smbios-parser.c
+++ b/lib/smbios-parser.c
@@ -50,14 +50,7 @@ static u8 *find_next_header(u8 *pos)
return pos;
}
-static struct smbios_header *get_next_header(struct smbios_header *curr)
-{
- u8 *pos = ((u8 *)curr) + curr->length;
-
- return (struct smbios_header *)find_next_header(pos);
-}
-
-static const struct smbios_header *next_header(const struct smbios_header *curr)
+static struct smbios_header *get_next_header(const struct smbios_header *curr)
{
u8 *pos = ((u8 *)curr) + curr->length;
@@ -73,7 +66,7 @@ const struct smbios_header *smbios_header(const struct smbios_entry *entry, int
if (header->type == type)
return header;
- header = next_header(header);
+ header = get_next_header(header);
}
return NULL;
--
2.43.0
More information about the U-Boot
mailing list