qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: qemu-devel@nongnu.org
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Subject: [Qemu-devel] [PATCH] etrax: Fix wrong conditional statement
Date: Fri, 30 Sep 2011 23:46:09 +0200	[thread overview]
Message-ID: <1317419169-8551-1-git-send-email-weil@mail.berlios.de> (raw)

cppcheck reports an error: the conditional statement is always true.

I assume that the register should be masked with 3,
but could not test the code.

Please test before applying this patch.

Cc: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/etraxfs_dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/etraxfs_dma.c b/hw/etraxfs_dma.c
index d3082ac..72f089e 100644
--- a/hw/etraxfs_dma.c
+++ b/hw/etraxfs_dma.c
@@ -599,12 +599,12 @@ dma_winvalid (void *opaque, target_phys_addr_t addr, uint32_t value)
 static void
 dma_update_state(struct fs_dma_ctrl *ctrl, int c)
 {
-	if ((ctrl->channels[c].regs[RW_CFG] & 1) != 3) {
+    if ((ctrl->channels[c].regs[RW_CFG] & 3) != 3) {
 		if (ctrl->channels[c].regs[RW_CFG] & 2)
 			ctrl->channels[c].state = STOPPED;
 		if (!(ctrl->channels[c].regs[RW_CFG] & 1))
 			ctrl->channels[c].state = RST;
-	}
+    }
 }
 
 static void
-- 
1.7.2.5

             reply	other threads:[~2011-09-30 21:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30 21:46 Stefan Weil [this message]
2011-10-03  8:24 ` [Qemu-devel] [PATCH] etrax: Fix wrong conditional statement Edgar E. Iglesias

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=1317419169-8551-1-git-send-email-weil@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=edgar.iglesias@gmail.com \
    --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).