From b5623dede7569cf74dd865748d17b0e413c03ee2 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 4 Jan 2017 22:22:56 +0100 Subject: libpayload: usb: handle situation with no free device address Change-Id: I1308bdca90f1a09d980f384ee85552198a39b965 Signed-off-by: Patrick Georgi Found-by: Coverity Scan #1260940 Reviewed-on: https://review.coreboot.org/18036 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- payloads/libpayload/drivers/usb/usb.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'payloads/libpayload/drivers') 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)); -- cgit v1.2.3