diff --git a/src/target/armv8_cache.c b/src/target/armv8_cache.c index cf7111950..98f4b3f04 100644 --- a/src/target/armv8_cache.c +++ b/src/target/armv8_cache.c @@ -286,8 +286,9 @@ static struct armv8_cachesize decode_cache_reg(uint32_t cache_reg) size.index = (cache_reg >> 13) & 0x7fff; size.way = ((cache_reg >> 3) & 0x3ff); - while (((size.way << i) & 0x80000000) == 0) - i++; + if (size.way != 0) + while (((size.way << i) & 0x80000000) == 0) + i++; size.way_shift = i; return size;