Blame SOURCES/0010-dmidecode-Share-common-EFI-code.patch

60918b
From 97d23fb9a642574ef4415e71e4a01387d06744d6 Mon Sep 17 00:00:00 2001
60918b
From: Jean Delvare <jdelvare@suse.de>
60918b
Date: Thu, 30 Nov 2017 16:27:56 +0100
60918b
Subject: [PATCH 10/10] dmidecode: Share common EFI code
60918b
60918b
Avoid duplicating code between OS-specific paths.
60918b
60918b
---
60918b
 dmidecode.c | 15 ++++++++-------
60918b
 1 file changed, 8 insertions(+), 7 deletions(-)
60918b
60918b
diff --git a/dmidecode.c b/dmidecode.c
60918b
index aadef75..87faaa9 100644
60918b
--- a/dmidecode.c
60918b
+++ b/dmidecode.c
60918b
@@ -4946,6 +4946,7 @@ static int address_from_efi(off_t *address)
60918b
 #elif defined(__FreeBSD__)
60918b
 	char addrstr[KENV_MVALLEN + 1];
60918b
 #endif
60918b
+	const char *eptype;
60918b
 	int ret;
60918b
 
60918b
 	*address = 0; /* Prevent compiler warning */
60918b
@@ -4970,9 +4971,7 @@ static int address_from_efi(off_t *address)
60918b
 		 || strcmp(linebuf, "SMBIOS") == 0)
60918b
 		{
60918b
 			*address = strtoull(addrp, NULL, 0);
60918b
-			if (!(opt.flags & FLAG_QUIET))
60918b
-				printf("# %s entry point at 0x%08llx\n",
60918b
-				       linebuf, (unsigned long long)*address);
60918b
+			eptype = linebuf;
60918b
 			ret = 0;
60918b
 			break;
60918b
 		}
60918b
@@ -4997,14 +4996,16 @@ static int address_from_efi(off_t *address)
60918b
 	}
60918b
 
60918b
 	*address = strtoull(addrstr, NULL, 0);
60918b
-	if (!(opt.flags & FLAG_QUIET))
60918b
-		printf("# SMBIOS entry point at 0x%08llx\n",
60918b
-		    (unsigned long long)*address);
60918b
-
60918b
+	eptype = "SMBIOS";
60918b
 	ret = 0;
60918b
 #else
60918b
 	ret = EFI_NOT_FOUND;
60918b
 #endif
60918b
+
60918b
+	if (ret == 0 && !(opt.flags & FLAG_QUIET))
60918b
+		printf("# %s entry point at 0x%08llx\n",
60918b
+		       eptype, (unsigned long long)*address);
60918b
+
60918b
 	return ret;
60918b
 }
60918b
 
60918b
-- 
60918b
2.9.5
60918b