diff options
-rw-r--r-- | lib/lmb.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -245,6 +245,11 @@ static unsigned long lmb_align_down(unsigned long addr, unsigned long size) | |||
245 | return addr & ~(size - 1); | 245 | return addr & ~(size - 1); |
246 | } | 246 | } |
247 | 247 | ||
248 | static unsigned long lmb_align_up(unsigned long addr, unsigned long size) | ||
249 | { | ||
250 | return (addr + (size - 1)) & ~(size - 1); | ||
251 | } | ||
252 | |||
248 | unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align, | 253 | unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align, |
249 | unsigned long max_addr) | 254 | unsigned long max_addr) |
250 | { | 255 | { |
@@ -281,7 +286,8 @@ unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align, | |||
281 | if (i < 0) | 286 | if (i < 0) |
282 | return 0; | 287 | return 0; |
283 | 288 | ||
284 | lmb_add_region(&lmb.reserved, base, size); | 289 | if (lmb_add_region(&lmb.reserved, base, lmb_align_up(size, align)) < 0) |
290 | return 0; | ||
285 | 291 | ||
286 | return base; | 292 | return base; |
287 | } | 293 | } |