On 5/30/23 15:28, BALATON Zoltan wrote:
No nead to store return value and break from loop when we can return
directly.

Signed-off-by: BALATON Zoltan <bala...@eik.bme.hu>


Reviewed-by: Cédric Le Goater <c...@kaod.org>

Thanks,

C.

---
  target/ppc/mmu_common.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/target/ppc/mmu_common.c b/target/ppc/mmu_common.c
index a84bc7de88..ff7f987546 100644
--- a/target/ppc/mmu_common.c
+++ b/target/ppc/mmu_common.c
@@ -521,19 +521,15 @@ int ppcemb_tlb_search(CPUPPCState *env, target_ulong 
address, uint32_t pid)
  {
      ppcemb_tlb_t *tlb;
      hwaddr raddr;
-    int i, ret;
+    int i;
- /* Default return value is no match */
-    ret = -1;
      for (i = 0; i < env->nb_tlb; i++) {
          tlb = &env->tlb.tlbe[i];
          if (ppcemb_tlb_check(env, tlb, &raddr, address, pid, i) == 0) {
-            ret = i;
-            break;
+            return i;
          }
      }
-
-    return ret;
+    return -1;
  }
static int mmu40x_get_physical_address(CPUPPCState *env, mmu_ctx_t *ctx,


Reply via email to