dmidecode-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dmidecode] [PATCH] dmidecode: Share common EFI code


From: Jean Delvare
Subject: [dmidecode] [PATCH] dmidecode: Share common EFI code
Date: Tue, 26 Sep 2017 09:27:28 +0200

Avoid duplicating code between OS-specific paths.
---
Alexey, assuming the previous patch works for you, can you please test
this one on top and confirm it doesn't break anything? Thanks.

 dmidecode.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

--- dmidecode.orig/dmidecode.c  2017-09-26 09:00:25.799403912 +0200
+++ dmidecode/dmidecode.c       2017-09-26 09:05:05.026038261 +0200
@@ -4946,6 +4946,7 @@ static int address_from_efi(off_t *addre
 #elif defined(__FreeBSD__)
        char addrstr[KENV_MVALLEN + 1];
 #endif
+       const char *eptype;
        int ret;
 
        *address = 0; /* Prevent compiler warning */
@@ -4970,9 +4971,7 @@ static int address_from_efi(off_t *addre
                 || strcmp(linebuf, "SMBIOS") == 0)
                {
                        *address = strtoull(addrp, NULL, 0);
-                       if (!(opt.flags & FLAG_QUIET))
-                               printf("# %s entry point at 0x%08llx\n",
-                                      linebuf, (unsigned long long)*address);
+                       eptype = linebuf;
                        ret = 0;
                        break;
                }
@@ -4997,12 +4996,15 @@ static int address_from_efi(off_t *addre
        }
 
        *address = strtoull(addrstr, NULL, 0);
-       if (!(opt.flags & FLAG_QUIET))
-               printf("# SMBIOS entry point at 0x%08llx\n",
-                   (unsigned long long)*address);
+       eptype = "SMBIOS";
 #else
        ret = EFI_NOT_FOUND;
 #endif
+
+       if (ret == 0 && !(opt.flags & FLAG_QUIET))
+               printf("# %s entry point at 0x%08llx\n",
+                      eptype, (unsigned long long)*address);
+
        return ret;
 }
 

-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]