[PATCH 1/1] lib: smbios: remove redundant next_header()

Heinrich Schuchardt xypron.glpk at gmx.de
Fri Dec 22 18:54:03 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.

Fixes: 3d49ee8510d3 ("efi_loader: add SMBIOS table measurement")
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 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