qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] etrax: Fix wrong conditional statement


From: Stefan Weil
Subject: [Qemu-devel] [PATCH] etrax: Fix wrong conditional statement
Date: Fri, 30 Sep 2011 23:46:09 +0200

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 <address@hidden>
Signed-off-by: Stefan Weil <address@hidden>
---
 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 via email to

[Prev in Thread] Current Thread [Next in Thread]