diff mbox

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

Message ID 1473041269-21797-1-git-send-email-oohall@gmail.com
State Accepted
Headers show

Commit Message

Oliver O'Halloran Sept. 5, 2016, 2:07 a.m. UTC
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@linux.vnet.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 core/vpd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Andrew Donnellan Sept. 5, 2016, 2:19 a.m. UTC | #1
On 05/09/16 12:07, Oliver O'Halloran wrote:
> +	if (!vpd || !vpd_lid_no) {
> +		prlog(PR_WARNING, "VPD: WARNING: Unable to iohub VPD lid");

Is this missing a verb?
Oliver O'Halloran Sept. 5, 2016, 3:23 a.m. UTC | #2
On Mon, Sep 5, 2016 at 12:19 PM, Andrew Donnellan
<andrew.donnellan@au1.ibm.com> wrote:
> On 05/09/16 12:07, Oliver O'Halloran wrote:
>>
>> +       if (!vpd || !vpd_lid_no) {
>> +               prlog(PR_WARNING, "VPD: WARNING: Unable to iohub VPD
>> lid");
>
>
> Is this missing a verb?

Err, yeah. That should probably be "unable to load".

>
> --
> Andrew Donnellan              OzLabs, ADL Canberra
> andrew.donnellan@au1.ibm.com  IBM Australia Limited
>
Stewart Smith Sept. 14, 2016, 6:50 a.m. UTC | #3
Oliver O'Halloran <oohall@gmail.com> writes:
> 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@linux.vnet.ibm.com>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Thanks, series merged to master (with verb fixage) as of
0754d2e8fce72548d19219544d0ef6c8d4101f06
diff mbox

Patch

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);