qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection


From: Bin Meng
Subject: Re: [PATCH v2 1/2] hw/dma: sifive_pdma: Fix Control.claim bit detection
Date: Mon, 27 Sep 2021 21:14:32 +0800

Hi Philippe,

On Mon, Sep 27, 2021 at 8:56 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 9/27/21 09:21, Bin Meng wrote:
> > At present the codes detect whether the DMA channel is claimed by:
> >
> >   claimed = !!s->chan[ch].control & CONTROL_CLAIM;
> >
> > As ! has higher precedence over & (bitwise and), this is essentially
> >
> >   claimed = (!!s->chan[ch].control) & CONTROL_CLAIM;
> >
> > which is wrong, as any non-zero bit set in the control register will
> > produce a result of a claimed channel.
>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Maybe worth adding:
>
> Reported using GCC 9.3.0 on Ubuntu 20.04:
>
>   suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’
> to ‘~’ [-Werror=parentheses]

Actually GCC does not report this as CONTROL_CLAIM happens to be 1 in
this case, as I wrote in the v1 commit message. :)

Regards,
Bin



reply via email to

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