From nobody Sun Feb 8 12:39:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1578335583; cv=none; d=zohomail.com; s=zohoarc; b=aCrrH3zxHJoUduOLuiTQBRyoLqF4XhPGfKQCkXk8O0y9QNbrk46APSHUCzYwug5yQquC0w1PGQYbBjP9QPBo0RVyLKNsCb7gKvp+UG09gcfl24AMYtymQ6f9Rsg4HytMAGx9eSTqDWCLkCN5fz9RE2DnPsxH6dUOxiGEhYu3LiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578335583; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eY6GwOKUsSxbSiC0sEZUPgTqkPSXyaF2//XptsTcqg0=; b=XnSm9gc7tGj/4fwd/+6qdBTFBIdOISvW5n8/ZGTQJNTU6ueMYGLkDUNgs+yWcYZvFjUzWsuUHXrKz6/2M91Hrwj+y1+LJZsowc4zFXJQNDUIxoBVb+PE2nENmebSBCzM8ZDiMNVZdMAA2ncBedRFCUWnJGqJUcIL+TEa7KPdxuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15783355834251018.00315423505; Mon, 6 Jan 2020 10:33:03 -0800 (PST) Received: from localhost ([::1]:57774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioXBV-00036F-Rb for importer@patchew.org; Mon, 06 Jan 2020 13:33:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ioX3q-0001el-Nh for qemu-devel@nongnu.org; Mon, 06 Jan 2020 13:25:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ioX3p-0003nI-87 for qemu-devel@nongnu.org; Mon, 06 Jan 2020 13:25:06 -0500 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:33219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ioX3p-0003n4-3a; Mon, 06 Jan 2020 13:25:05 -0500 Received: by mail-qv1-xf43.google.com with SMTP id z3so19445708qvn.0; Mon, 06 Jan 2020 10:25:05 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:655b:9e1c:e865:3705:e1df]) by smtp.gmail.com with ESMTPSA id b81sm21026522qkc.135.2020.01.06.10.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 10:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eY6GwOKUsSxbSiC0sEZUPgTqkPSXyaF2//XptsTcqg0=; b=Ir10aGHisUato561BZTbYR+T9sXZkJZa09fi7GWiq733xHdB0qdupgf6KGp2/jlp72 9liT2tk+YwLFfMuybNo72GaPvgAK70rwojOb2rBHSiLquEVIYZ404wx8/NWW9Kj0qMR1 DkyB9UexOsa5+H11jhW4kYgvjimYr2O9EYdfEQp2bM3W08jAJgnF21yC3x/SEqTARsi7 3Xor9+ML05wbwttIZSIZ6OIdKpEnX7HFyFSBcTDx+plwF4R4apt8Jg+hVXUEt5zQVhq9 LGYTVvXLm8YRjrCa1ksHW9676g+sv59z+e1W/3g9YjAKVd6nwkoAcB0JCMRAkyeaAy3i exeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eY6GwOKUsSxbSiC0sEZUPgTqkPSXyaF2//XptsTcqg0=; b=nV9P8rFlBwJ0JUrVPa4mfcKB+RnysB5oon7rRGKRL+5ggkboCqFCZJVwmnj/yaMjnV wCjjaZJymlOZaDUc9Qeagf5qhDg1Yk+eB1jULDw4n29ZEgaT1ugqB/qCKp82PqjnbvYd gHMdHjFlXXd1l5gbaW+/XwOhCFDnCOT5VXxpidQkY31St5ZBWY4Me2O0meVSBpJULSXo eOkrJ9RipyiQmBL0bbO4QtYRyoydNZo/SU8CopQ+rhsaatQKzIb/kPW98wXzmiQjr033 QWAYXS76+6lbq8uLPtdBVwLQb7UyjyEf+Z4tlW6kusC3v0Pw9Y87i/n5aENTkYdKOUFP q7YQ== X-Gm-Message-State: APjAAAW4xq10+H7O0mlandP7wwrjiozRI5q8vhY41fCz4Dsj+ztpKnUT oeoLpSZNOErDYLwPEMlJCGGjXsXo X-Google-Smtp-Source: APXvYqy1QFUQeLXKMDt2TJuYG88b704qBzioKoASnhKiJguwt1zbK+ohgbdq9BwNC8spt6Uq6hNRDw== X-Received: by 2002:a0c:c542:: with SMTP id y2mr6110998qvi.225.1578335104537; Mon, 06 Jan 2020 10:25:04 -0800 (PST) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Subject: [PATCH v1 07/59] unicore32/softmmu.c: remove 'do_fault' label in get_phys_addr_ucv2() Date: Mon, 6 Jan 2020 15:23:33 -0300 Message-Id: <20200106182425.20312-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106182425.20312-1-danielhb413@gmail.com> References: <20200106182425.20312-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f43 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Daniel Henrique Barboza , Guan Xuetao Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" 'do_fault' is a label that executes 'return code'. The 'code' variable is an integer that is set to zero, then in all instances it is set to another value right before 'do_fault'. We can get rid of both the label and the variable to make the code a bit cleaner. CC: Guan Xuetao Signed-off-by: Daniel Henrique Barboza --- target/unicore32/softmmu.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c index cbdaa500b7..3373400cba 100644 --- a/target/unicore32/softmmu.c +++ b/target/unicore32/softmmu.c @@ -125,7 +125,6 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env, u= int32_t address, target_ulong *page_size) { CPUState *cs =3D env_cpu(env); - int code; uint32_t table; uint32_t desc; uint32_t phys_addr; @@ -135,13 +134,11 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env,= uint32_t address, table =3D env->cp0.c2_base & 0xfffff000; table |=3D (address >> 20) & 0xffc; desc =3D ldl_phys(cs->as, table); - code =3D 0; switch (PAGETABLE_TYPE(desc)) { case 3: /* Superpage */ if (!(desc & UC32_PAGETABLE_EXIST)) { - code =3D 0x0b; /* superpage miss */ - goto do_fault; + return 0x0b; /* superpage miss */ } phys_addr =3D (desc & 0xffc00000) | (address & 0x003fffff); *page_size =3D SUPERPAGE_SIZE; @@ -152,8 +149,7 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env, u= int32_t address, DPRINTF("PGD address %x, desc %x\n", table, desc); } if (!(desc & UC32_PAGETABLE_EXIST)) { - code =3D 0x05; /* second pagetable miss */ - goto do_fault; + return 0x05; /* second pagetable miss */ } table =3D (desc & 0xfffff000) | ((address >> 10) & 0xffc); desc =3D ldl_phys(cs->as, table); @@ -162,8 +158,7 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env, u= int32_t address, DPRINTF("PTE address %x, desc %x\n", table, desc); } if (!(desc & UC32_PAGETABLE_EXIST)) { - code =3D 0x08; /* page miss */ - goto do_fault; + return 0x08; /* page miss */ } switch (PAGETABLE_TYPE(desc)) { case 0: @@ -185,8 +180,7 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env, u= int32_t address, *prot |=3D PAGE_READ; } else { if (is_user && (access_type =3D=3D 0)) { - code =3D 0x11; /* access unreadable area */ - goto do_fault; + return 0x11; /* access unreadable area */ } } =20 @@ -194,8 +188,7 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env, u= int32_t address, *prot |=3D PAGE_WRITE; } else { if (is_user && (access_type =3D=3D 1)) { - code =3D 0x12; /* access unwritable area */ - goto do_fault; + return 0x12; /* access unwritable area */ } } =20 @@ -203,13 +196,11 @@ static int get_phys_addr_ucv2(CPUUniCore32State *env,= uint32_t address, *prot |=3D PAGE_EXEC; } else { if (is_user && (access_type =3D=3D 2)) { - code =3D 0x13; /* access unexecutable area */ - goto do_fault; + return 0x13; /* access unexecutable area */ } } =20 -do_fault: - return code; + return 0; } =20 bool uc32_cpu_tlb_fill(CPUState *cs, vaddr address, int size, --=20 2.24.1