qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH] target-mips: Fix warning caused by unused local variable
Date: Sun,  8 May 2011 10:24:39 +0200	[thread overview]
Message-ID: <1304843079-29735-1-git-send-email-weil@mail.berlios.de> (raw)

cppcheck report:
target-mips/helper.c:276: style:
 Variable 'access_type' is assigned a value that is never used

'access_type' is only used for system emulation, so the patch
simply fixes the conditional compilation.

There remains an issue with the return value 'ret' in user mode emulation.
The assignment ret = TLBRET_NOMATCH is without effect because there is
a ret = 1 later. Which one is correct?

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 target-mips/helper.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/target-mips/helper.c b/target-mips/helper.c
index bdc1e53..f3cd521 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -272,8 +272,8 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
 #if !defined(CONFIG_USER_ONLY)
     target_phys_addr_t physical;
     int prot;
-#endif
     int access_type;
+#endif
     int ret = 0;
 
 #if 0
@@ -284,13 +284,13 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
 
     rw &= 1;
 
+#if defined(CONFIG_USER_ONLY)
+    ret = TLBRET_NOMATCH;
+#else
     /* data access */
     /* XXX: put correct access by using cpu_restore_state()
        correctly */
     access_type = ACCESS_INT;
-#if defined(CONFIG_USER_ONLY)
-    ret = TLBRET_NOMATCH;
-#else
     ret = get_physical_address(env, &physical, &prot,
                                address, rw, access_type);
     qemu_log("%s address=" TARGET_FMT_lx " ret %d physical " TARGET_FMT_plx " prot %d\n",
-- 
1.7.2.5

             reply	other threads:[~2011-05-08  8:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-08  8:24 Stefan Weil [this message]
2011-05-14 23:01 ` [Qemu-devel] [PATCH] target-mips: Fix warning caused by unused local variable Aurelien Jarno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304843079-29735-1-git-send-email-weil@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).