[Skiboot] [PATCH 1/3] core/vpd: remove assert() when checking for VPD

Oliver O'Halloran oohall at gmail.com
Mon Sep 5 12:07:47 AEST 2016


The VPD LID is used on FSP machines to discover hotpluggable PCI slots.
Currently if we fail to load the LID skiboot will fail an assert()
preventing the system from booting. This is excessive since this is an
otherwise recoverable failure. This patch converts the assert() to an
if-NULL-return check so we can continue to boot.

Cc: Gavin Shan <gwshan at linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/vpd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/core/vpd.c b/core/vpd.c
index 85a993730946..d706b5575fd7 100644
--- a/core/vpd.c
+++ b/core/vpd.c
@@ -61,6 +61,9 @@ const void *vpd_find_record(const void *vpd, size_t vpd_size,
 	uint8_t namesz = 0;
 	const char *rec_name;
 
+	if (!vpd)
+		return NULL;
+
 	while (CHECK_SPACE(p, 4, end)) {
 		/* Get header byte */
 		if (*(p++) != 0x84) {
@@ -186,8 +189,10 @@ void vpd_iohub_load(struct dt_node *hub_node)
 	lxrn = p[0];
         lx = (const char *)&p[1];
 
-	assert(vpd);
-	assert(vpd_lid_no);
+	if (!vpd || !vpd_lid_no) {
+		prlog(PR_WARNING, "VPD: WARNING: Unable to iohub VPD lid");
+		return;
+	}
 
 	r = fsp_wait_lid_loaded(vpd_lid_no);
 
-- 
2.5.5



More information about the Skiboot mailing list