hw/dma: sifive_pdma: Fix Control.claim bit detection
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.
Fixes: de7c7988d2
("hw/dma: sifive_pdma: reset Next* registers when Control.claim is set")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20210927072124.1564129-1-bmeng.cn@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
31ca70b5ff
commit
b7af62ae2c
@ -243,7 +243,7 @@ static void sifive_pdma_write(void *opaque, hwaddr offset,
|
|||||||
offset &= 0xfff;
|
offset &= 0xfff;
|
||||||
switch (offset) {
|
switch (offset) {
|
||||||
case DMA_CONTROL:
|
case DMA_CONTROL:
|
||||||
claimed = !!s->chan[ch].control & CONTROL_CLAIM;
|
claimed = !!(s->chan[ch].control & CONTROL_CLAIM);
|
||||||
|
|
||||||
if (!claimed && (value & CONTROL_CLAIM)) {
|
if (!claimed && (value & CONTROL_CLAIM)) {
|
||||||
/* reset Next* registers */
|
/* reset Next* registers */
|
||||||
|
Loading…
Reference in New Issue
Block a user