git: d19f1559d008 - stable/14 - libsa: smbios_detect(): Return the entry point address

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 08 Apr 2025 13:41:11 UTC
The branch stable/14 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=d19f1559d008290f87d303b22833f66eaef61e36

commit d19f1559d008290f87d303b22833f66eaef61e36
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-03-05 10:27:50 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-04-08 13:38:28 +0000

    libsa: smbios_detect(): Return the entry point address
    
    In particular, this allows the caller to know whether the detection was
    successful.
    
    Reviewed by:    imp, markj
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D49290
    
    (cherry picked from commit 9dad0ba286807c4aa2886f13705fca2334bb4759)
---
 stand/libsa/smbios.c | 6 ++++--
 stand/libsa/smbios.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/stand/libsa/smbios.c b/stand/libsa/smbios.c
index c7d9f1074fad..54cfac58b19e 100644
--- a/stand/libsa/smbios.c
+++ b/stand/libsa/smbios.c
@@ -635,7 +635,7 @@ smbios_probe(const caddr_t addr)
 	}
 }
 
-void
+caddr_t
 smbios_detect(const caddr_t addr)
 {
 	char		buf[16];
@@ -644,7 +644,7 @@ smbios_detect(const caddr_t addr)
 
 	smbios_probe(addr);
 	if (smbios.addr == NULL)
-		return;
+		return (NULL);
 
 	for (dmi = smbios.addr, i = 0; dmi != NULL &&
 	    dmi < smbios.addr + smbios.length && i < smbios.count; i++)
@@ -667,6 +667,8 @@ smbios_detect(const caddr_t addr)
 		sprintf(buf, "%u", smbios.populated_sockets);
 		setenv("smbios.socket.populated", buf, 1);
 	}
+
+	return (smbios.addr);
 }
 
 static int
diff --git a/stand/libsa/smbios.h b/stand/libsa/smbios.h
index 77dd6bd52a7e..f3fd394ec7fc 100644
--- a/stand/libsa/smbios.h
+++ b/stand/libsa/smbios.h
@@ -26,7 +26,7 @@
 #ifndef _SMBIOS_H_
 #define	_SMBIOS_H_
 
-void	smbios_detect(const caddr_t);
+caddr_t	smbios_detect(const caddr_t);
 int	smbios_match(const char *, const char *, const char *);
 
 #endif /* _SMBIOS_H_ */