diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-13 06:29:58 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-13 06:29:58 +0100 |
commit | 7afe16c2bbf065e30d692423ad2c7e77c4cfe9a5 (patch) | |
tree | 1a6b4e6a3ccbd5dcd462f1eaa05e349e9c9945f9 /lib | |
parent | Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kerne... (diff) | |
parent | Linus 2.6.29-rc8 (diff) | |
download | linux-7afe16c2bbf065e30d692423ad2c7e77c4cfe9a5.tar.xz linux-7afe16c2bbf065e30d692423ad2c7e77c4cfe9a5.zip |
Merge commit 'v2.6.29-rc8' into tracing/ftrace
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 1338469ac849..35a1f7ff4149 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -948,15 +948,15 @@ done: */ int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) { - int pos; /* scans bitmap by regions of size order */ + int pos, end; /* scans bitmap by regions of size order */ - for (pos = 0; pos < bits; pos += (1 << order)) - if (__reg_op(bitmap, pos, order, REG_OP_ISFREE)) - break; - if (pos == bits) - return -ENOMEM; - __reg_op(bitmap, pos, order, REG_OP_ALLOC); - return pos; + for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) { + if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) + continue; + __reg_op(bitmap, pos, order, REG_OP_ALLOC); + return pos; + } + return -ENOMEM; } EXPORT_SYMBOL(bitmap_find_free_region); |