Some boards ask for a large amount of ram for scratch pad usage, and it is possible the allocation will fail.
Signed-off-by: Kevin O'Connor kevin@koconnor.net ---
I've pushed this to the xhci-testing branch at: https://github.com/KevinOConnor/seabios/tree/xhci-testing
--- src/hw/usb-xhci.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c index 51ef6f4..daa7b5a 100644 --- a/src/hw/usb-xhci.c +++ b/src/hw/usb-xhci.c @@ -687,6 +687,12 @@ configure_xhci(void *data) dprintf(3, "%s: setup %d scratch pad buffers\n", __func__, spb); u64 *spba = memalign_high(64, sizeof(*spba) * spb); void *pad = memalign_high(PAGE_SIZE, PAGE_SIZE * spb); + if (!spba || !pad) { + warn_noalloc(); + free(spba); + free(pad); + goto fail; + } int i; for (i = 0; i < spb; i++) spba[i] = (u32)pad + (i * PAGE_SIZE);