Received: from eggs.gnu.org ([208.118.235.92]:45795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfvRY-0006Ag-Kj for qemu-devel@nongnu.org; Fri, 24 May 2013 13:06:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfvRS-0001y5-TT for qemu-devel@nongnu.org; Fri, 24 May 2013 13:06:16 -0400 Received: from mail-ee0-f43.google.com ([74.125.83.43]:61007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfvRS-0001xj-ET for qemu-devel@nongnu.org; Fri, 24 May 2013 13:06:10 -0400 Received: by mail-ee0-f43.google.com with SMTP id d41so2836724eek.16 for ; Fri, 24 May 2013 10:06:09 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 24 May 2013 19:05:38 +0200 Message-Id: <1369415157-8953-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369415157-8953-1-git-send-email-pbonzini@redhat.com> References: <1369415157-8953-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 03/22] cputlb: simplify tlb_set_page List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org The same "if" condition is repeated twice. Signed-off-by: Paolo Bonzini --- cputlb.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cputlb.c b/cputlb.c index aba7e44..b56bc01 100644 --- a/cputlb.c +++ b/cputlb.c @@ -262,17 +262,14 @@ void tlb_set_page(CPUArchState *env, target_ulong vaddr, #endif address = vaddr; - if (!(memory_region_is_ram(section->mr) || - memory_region_is_romd(section->mr))) { - /* IO memory case (romd handled later) */ + if (!memory_region_is_ram(section->mr) && !memory_region_is_romd(section->mr)) { + /* IO memory case */ address |= TLB_MMIO; - } - if (memory_region_is_ram(section->mr) || - memory_region_is_romd(section->mr)) { + addend = 0; + } else { + /* TLB_MMIO for rom/romd handled below */ addend = (uintptr_t)memory_region_get_ram_ptr(section->mr) + memory_region_section_addr(section, paddr); - } else { - addend = 0; } code_address = address; -- 1.8.1.4