libpayload: Catch null-pointer dereference in xHCI

Fix a possible null-pointer dereference (hopefully) before anyone runs
into this. Also don't switch ports to xHCI if initialization failed.

Change-Id: I5dbaeb435a98ead0b50d27fde13c9f1433ea3e81
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: http://review.coreboot.org/6245
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Nico Huber 2014-07-07 17:11:53 +02:00 committed by Patrick Georgi
parent 8b8e96370d
commit f4316f8c10
1 changed files with 4 additions and 2 deletions

View File

@ -312,9 +312,11 @@ xhci_pci_init (pcidev_t addr)
}
controller = xhci_init((unsigned long)reg_addr);
controller->pcidev = addr;
if (controller) {
controller->pcidev = addr;
xhci_switch_ppt_ports(addr);
xhci_switch_ppt_ports(addr);
}
return controller;
}