Skip to content

Commit b7af62a

Browse files
lbmengalistair23
authored andcommitted
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: de7c798 ("hw/dma: sifive_pdma: reset Next* registers when Control.claim is set") Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-id: [email protected] Signed-off-by: Alistair Francis <[email protected]>
1 parent 31ca70b commit b7af62a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hw/dma/sifive_pdma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static void sifive_pdma_write(void *opaque, hwaddr offset,
243243
offset &= 0xfff;
244244
switch (offset) {
245245
case DMA_CONTROL:
246-
claimed = !!s->chan[ch].control & CONTROL_CLAIM;
246+
claimed = !!(s->chan[ch].control & CONTROL_CLAIM);
247247

248248
if (!claimed && (value & CONTROL_CLAIM)) {
249249
/* reset Next* registers */

0 commit comments

Comments
 (0)