Hello! On Sun, Sep 23, 2012 at 3:06 PM, Graeme Russ <graeme.r...@gmail.com> wrote: > > On Sep 23, 2012 8:09 AM, "Tomas Hlavacek" <tmshl...@gmail.com> wrote: >> >> early_malloc for DM with support for more heaps and lightweight >> first heap in the same memory as an early stack. >> >> Adaptation layer for seamless calling of early_malloc or dlmalloc from >> DM based on init stage added (dmmalloc() and related functions). >> >> Signed-off-by: Tomas Hlavacek <tmshl...@gmail.com> >> --- > > [snip] > >> +#ifdef CONFIG_SYS_EARLY_MALLOC >> +__weak struct early_heap_header *early_brk(size_t size) >> +{ >> + struct early_heap_header *h = >> + (struct early_heap_header *)CONFIG_SYS_EARLY_HEAP_ADDR; >> + struct early_heap_header *ehp = gd->early_heap_first; >> + >> + while (ehp != NULL) { >> + if (ehp == h) >> + return NULL; >> + >> + ehp = ehp->next_early_heap; >> + } > > if (g->early_heap_first == NULL) > h = CONFIF_SYS_EARLY_HEAP_ADDR); > else > return NULL;
Yes, I was too paranoid. What about: if (g->early_heap_first != NULL) return NULL; > >> + >> + h->free_space_pointer = (void *)(roundup( >> + (phys_addr_t)CONFIG_SYS_EARLY_HEAP_ADDR + >> + sizeof(struct early_heap_header), >> + sizeof(phys_addr_t))); >> + h->free_bytes = size - roundup(sizeof(struct early_heap_header), >> + sizeof(phys_addr_t)); >> + h->next_early_heap = NULL; >> + >> + return h; >> +} > Tomas _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot