Skip to content

Commit

Permalink
dmaengine: xilinx: xdma: Fix interrupt vector setting
Browse files Browse the repository at this point in the history
A couple of hardware registers need to be set to reflect which
interrupts have been allocated to the device. Each register is 32-bit
wide and can receive four 8-bit values. If we provide any other interrupt
number than four, the irq_num variable will never be 0 within the while
check and the while block will loop forever.

There is an easy way to prevent this: just break the for loop
when we reach "irq_num == 0", which anyway means all interrupts have
been processed.

Cc: [email protected]
Fixes: 17ce252 ("dmaengine: xilinx: xdma: Add xilinx xdma driver")
Signed-off-by: Miquel Raynal <[email protected]>
Acked-by: Lizhi Hou <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
miquelraynal authored and vinodkoul committed Aug 6, 2023
1 parent 74d7221 commit 96891e9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/dma/xilinx/xdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,8 @@ static int xdma_set_vector_reg(struct xdma_device *xdev, u32 vec_tbl_start,
val |= irq_start << shift;
irq_start++;
irq_num--;
if (!irq_num)
break;
}

/* write IRQ register */
Expand Down

0 comments on commit 96891e9

Please sign in to comment.