diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-18 04:57:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-18 04:57:02 -0400 |
commit | 37ba317c9ed19eb126e40bbf563f2711e191a636 (patch) | |
tree | c5865768f341fc0ab41899fe9af9dc5918784cee /lib | |
parent | 708dc5125309cd33c5daaad3026cc4ae6ef39c8b (diff) | |
parent | ee568b25ee9e160b32d1aef73d8b2ee9c05d34db (diff) |
Merge branches 'sched/cleanups' and 'linus' into sched/core
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 | ||