X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=lib%2Faxmap.c;h=e4e40bf063fcd5297716d490a1f24d8269b71642;hp=4dd4644bf8c97fcc4fe62282bdd067d4e2219cbb;hb=41264298bb85d7eb67ead8f96a0770dd07bfa934;hpb=c406445ac5bf84ea1e529a755c157aa2a563e306 diff --git a/lib/axmap.c b/lib/axmap.c index 4dd4644b..e4e40bf0 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -175,7 +175,6 @@ static bool axmap_handler(struct axmap *axmap, uint64_t bit_nr, static bool axmap_handler_topdown(struct axmap *axmap, uint64_t bit_nr, bool (*func)(struct axmap_level *, unsigned long, unsigned int, void *)) { - struct axmap_level *al; int i; for (i = axmap->nr_levels - 1; i >= 0; i--) { @@ -183,9 +182,7 @@ static bool axmap_handler_topdown(struct axmap *axmap, uint64_t bit_nr, unsigned long offset = index >> UNIT_SHIFT; unsigned int bit = index & BLOCKS_PER_UNIT_MASK; - al = &axmap->levels[i]; - - if (func(al, offset, bit, NULL)) + if (func(&axmap->levels[i], offset, bit, NULL)) return true; } @@ -346,13 +343,8 @@ static uint64_t axmap_find_first_free(struct axmap *axmap, unsigned int level, for (i = level; i >= 0; i--) { struct axmap_level *al = &axmap->levels[i]; - /* - * Clear 'ret', this is a bug condition. - */ - if (index >= al->map_size) { - ret = -1ULL; - break; - } + if (index >= al->map_size) + goto err; for (j = index; j < al->map_size; j++) { if (al->map[j] == -1UL) @@ -370,6 +362,7 @@ static uint64_t axmap_find_first_free(struct axmap *axmap, unsigned int level, if (ret < axmap->nr_bits) return ret; +err: return (uint64_t) -1ULL; }