diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-03-25 14:31:35 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-03-25 14:31:35 -0400 |
commit | 8937b7349ca9e25a02b2a72ccb7fba404ddedc5b (patch) | |
tree | 434ffe23d318f8af55850a26c3431ce8b82ab6f4 /lib | |
parent | 997302259f386bca8fe1db67c50296ca426c438f (diff) | |
parent | ffe7f95bb1a4d1e9ca5d252445dc38476e1a208e (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 into devel
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: | |||
948 | */ | 948 | */ |
949 | int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) | 949 | int bitmap_find_free_region(unsigned long *bitmap, int bits, int order) |
950 | { | 950 | { |
951 | int pos; /* scans bitmap by regions of size order */ | 951 | int pos, end; /* scans bitmap by regions of size order */ |
952 | 952 | ||
953 | for (pos = 0; pos < bits; pos += (1 << order)) | 953 | for (pos = 0 ; (end = pos + (1 << order)) <= bits; pos = end) { |
954 | if (__reg_op(bitmap, pos, order, REG_OP_ISFREE)) | 954 | if (!__reg_op(bitmap, pos, order, REG_OP_ISFREE)) |
955 | break; | 955 | continue; |
956 | if (pos == bits) | 956 | __reg_op(bitmap, pos, order, REG_OP_ALLOC); |
957 | return -ENOMEM; | 957 | return pos; |
958 | __reg_op(bitmap, pos, order, REG_OP_ALLOC); | 958 | } |
959 | return pos; | 959 | return -ENOMEM; |
960 | } | 960 | } |
961 | EXPORT_SYMBOL(bitmap_find_free_region); | 961 | EXPORT_SYMBOL(bitmap_find_free_region); |
962 | 962 | ||