projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
at91: define matrix registers bit fields
[oweals/u-boot.git]
/
common
/
dlmalloc.c
diff --git
a/common/dlmalloc.c
b/common/dlmalloc.c
index ca088a17d1596fc192be4cd3dc12b9b2ab2a411c..2276532da7a8441c500c39b1716e23a2806a8c21 100644
(file)
--- a/
common/dlmalloc.c
+++ b/
common/dlmalloc.c
@@
-1515,18
+1515,13
@@
void *sbrk(ptrdiff_t increment)
ulong new = old + increment;
if ((new < mem_malloc_start) || (new > mem_malloc_end))
ulong new = old + increment;
if ((new < mem_malloc_start) || (new > mem_malloc_end))
- return
NULL
;
+ return
(void *)MORECORE_FAILURE
;
mem_malloc_brk = new;
return (void *)old;
}
mem_malloc_brk = new;
return (void *)old;
}
-#ifndef CONFIG_X86
-/*
- * x86 boards use a slightly different init sequence thus they implement
- * their own version of mem_malloc_init()
- */
void mem_malloc_init(ulong start, ulong size)
{
mem_malloc_start = start;
void mem_malloc_init(ulong start, ulong size)
{
mem_malloc_start = start;
@@
-1535,7
+1530,6
@@
void mem_malloc_init(ulong start, ulong size)
memset((void *)mem_malloc_start, 0, size);
}
memset((void *)mem_malloc_start, 0, size);
}
-#endif
/* field-extraction macros */
/* field-extraction macros */
@@
-2185,6
+2179,12
@@
Void_t* mALLOc(bytes) size_t bytes;
INTERNAL_SIZE_T nb;
INTERNAL_SIZE_T nb;
+ /* check if mem_malloc_init() was run */
+ if ((mem_malloc_start == 0) && (mem_malloc_end == 0)) {
+ /* not initialized yet */
+ return 0;
+ }
+
if ((long)bytes < 0) return 0;
nb = request2size(bytes); /* padded request size; */
if ((long)bytes < 0) return 0;
nb = request2size(bytes); /* padded request size; */