diff options
author | Nico Huber <nico.huber@secunet.com> | 2014-07-07 17:11:53 +0200 |
---|---|---|
committer | Patrick Georgi <patrick@georgi-clan.de> | 2014-07-10 20:55:41 +0200 |
commit | f4316f8c101b956af624b0c046c418b4489f6558 (patch) | |
tree | b73a53fc2ff71f85651c302c1beba9be21735a95 | |
parent | 8b8e96370dc709299da7a6393f6e190bb557685e (diff) |
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>
-rw-r--r-- | payloads/libpayload/drivers/usb/xhci.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/payloads/libpayload/drivers/usb/xhci.c b/payloads/libpayload/drivers/usb/xhci.c index 97c27bcd50..69ddab791a 100644 --- a/payloads/libpayload/drivers/usb/xhci.c +++ b/payloads/libpayload/drivers/usb/xhci.c @@ -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; } |