Message ID | 1317419169-8551-1-git-send-email-weil@mail.berlios.de |
---|---|
State | Superseded |
Headers | show |
On Fri, Sep 30, 2011 at 11:46:09PM +0200, Stefan Weil wrote: > 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. Thanks Stefan, I tested & committed a patch that removes the bogus if statement. Cheers
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
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(-)