From: Kevin O'Connor Date: Mon, 20 Jan 2014 16:46:16 +0000 (-0500) Subject: xhci: Check if scratch pad allocation fails. X-Git-Tag: rel-1.7.5-rc1~51 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=386a81ee2c8487ee414652a540b820b87c6b6351;p=seabios.git xhci: Check if scratch pad allocation fails. 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 --- diff --git a/src/hw/usb-xhci.c b/src/hw/usb-xhci.c index dc54182..65d1be0 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);