summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2017-01-04 22:22:56 +0100
committerMartin Roth <martinroth@google.com>2017-01-06 18:43:05 +0100
commitb5623dede7569cf74dd865748d17b0e413c03ee2 (patch)
tree21592fd00fcdb509d3143afe0ab67c26dc3d9efe
parenta370ae855627364694c089e9a69a98fc837bfb0f (diff)
downloadcoreboot-b5623dede7569cf74dd865748d17b0e413c03ee2.tar.xz
libpayload: usb: handle situation with no free device address
Change-Id: I1308bdca90f1a09d980f384ee85552198a39b965 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Found-by: Coverity Scan #1260940 Reviewed-on: https://review.coreboot.org/18036 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--payloads/libpayload/drivers/usb/usb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/usb/usb.c b/payloads/libpayload/drivers/usb/usb.c
index bfb697d619..bb42f89826 100644
--- a/payloads/libpayload/drivers/usb/usb.c
+++ b/payloads/libpayload/drivers/usb/usb.c
@@ -336,6 +336,8 @@ generic_set_address (hci_t *controller, usb_speed speed,
int hubport, int hubaddr)
{
int adr = get_free_address (controller); // address to set
+ if (adr < 0)
+ return NULL;
dev_req_t dr;
memset (&dr, 0, sizeof (dr));