oops, these two were missed in the last cleanup.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4475 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
5fe6e23c61
commit
8f95edaabd
|
@ -271,8 +271,14 @@ static struct align_region_t* align_regions = 0;
|
||||||
static struct align_region_t *allocate_region(struct align_region_t *old_first, int alignment, int num_elements)
|
static struct align_region_t *allocate_region(struct align_region_t *old_first, int alignment, int num_elements)
|
||||||
{
|
{
|
||||||
struct align_region_t *new_region = malloc(sizeof(struct align_region_t));
|
struct align_region_t *new_region = malloc(sizeof(struct align_region_t));
|
||||||
|
if (!new_region)
|
||||||
|
return NULL;
|
||||||
new_region->alignment = alignment;
|
new_region->alignment = alignment;
|
||||||
new_region->start = malloc((num_elements+1) * alignment + num_elements);
|
new_region->start = malloc((num_elements+1) * alignment + num_elements);
|
||||||
|
if (!new_region->start) {
|
||||||
|
free(new_region);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
new_region->start_data = (void*)((u32)(new_region->start + num_elements + alignment - 1) & (~(alignment-1)));
|
new_region->start_data = (void*)((u32)(new_region->start + num_elements + alignment - 1) & (~(alignment-1)));
|
||||||
new_region->size = num_elements * alignment;
|
new_region->size = num_elements * alignment;
|
||||||
new_region->free = num_elements;
|
new_region->free = num_elements;
|
||||||
|
|
Loading…
Reference in New Issue