The current code always picks slot 0 in the reuse case. (This doesn't seem
to matter in the cases I've tested, though.)
Signed-off-by: Alyssa Milburn <fuzzie(a)fuzzie.org>
---
arch/ppc/qemu/ofmem.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/ppc/qemu/ofmem.c b/arch/ppc/qemu/ofmem.c
index 6f346a3..c9fe154 100644
--- a/arch/ppc/qemu/ofmem.c
+++ b/arch/ppc/qemu/ofmem.c
@@ -359,9 +359,11 @@ hash_page_64(unsigned long ea, phys_addr_t phys, ucell mode)
found = 1;
/* otherwise use a free slot */
- for (i = 0; !found && i < 8; i++)
- if (!pp[i].v)
- found = 1;
+ if (!found) {
+ for (i = 0; !found && i < 8; i++)
+ if (!pp[i].v)
+ found = 1;
+ }
/* out of slots, just evict one */
if (!found)
@@ -414,9 +416,11 @@ hash_page_32(unsigned long ea, phys_addr_t phys, ucell mode)
found = 1;
/* otherwise use a free slot */
- for (i = 0; !found && i < 8; i++)
- if (!pp[i].v)
- found = 1;
+ if (!found) {
+ for (i = 0; !found && i < 8; i++)
+ if (!pp[i].v)
+ found = 1;
+ }
/* out of slots, just evict one */
if (!found)
--
2.1.0