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>
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);