[PATCH 2/5] dummy_malloc: Make use of PTR_ALIGN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Drop explicit type cast and alignement code in favor of PTR_ALIGN

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 common/dummy_malloc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/dummy_malloc.c b/common/dummy_malloc.c
index fa4f5d126..ab6712018 100644
--- a/common/dummy_malloc.c
+++ b/common/dummy_malloc.c
@@ -30,11 +30,9 @@ void malloc_stats(void)
 
 void *memalign(size_t alignment, size_t bytes)
 {
-	unsigned long mem = (unsigned long)sbrk(bytes + alignment);
+	void *mem = sbrk(bytes + alignment);
 
-	mem = (mem + alignment) & ~(alignment - 1);
-
-	return (void *)mem;
+	return PTR_ALIGN(mem, alignment);
 }
 
 void *malloc(size_t size)
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux