qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] etrax: Fix wrong conditional statement
@ 2011-09-30 21:46 Stefan Weil
  2011-10-03  8:24 ` Edgar E. Iglesias
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2011-09-30 21:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Edgar E. Iglesias

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-03  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-30 21:46 [Qemu-devel] [PATCH] etrax: Fix wrong conditional statement Stefan Weil
2011-10-03  8:24 ` Edgar E. Iglesias

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).