diff options
author | Srikanth Thokala <srikanth.thokala@xilinx.com> | 2014-11-05 13:37:00 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-11-06 02:41:47 -0500 |
commit | 049c0d577d63c6a95edd5f59fa192f89f2674a64 (patch) | |
tree | a5d6718666fbddbe9517f1d23e86a276222a89ee | |
parent | cd166280b7a1d74248897b48aea39217015ee8c2 (diff) |
dmaengine: xilinx: vdma: Check if the segment list is empty in a descriptor
The segment list in a descriptor should be checked for empty, else
it will try to access invalid address for the first call. This
patch fixes this issue.
Signed-off-by: Srikanth Thokala <sthokal@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/xilinx/xilinx_vdma.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/dma/xilinx/xilinx_vdma.c b/drivers/dma/xilinx/xilinx_vdma.c index a6e64767186e..10937945a527 100644 --- a/drivers/dma/xilinx/xilinx_vdma.c +++ b/drivers/dma/xilinx/xilinx_vdma.c | |||
@@ -971,9 +971,11 @@ xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchan, | |||
971 | hw->buf_addr = xt->src_start; | 971 | hw->buf_addr = xt->src_start; |
972 | 972 | ||
973 | /* Link the previous next descriptor to current */ | 973 | /* Link the previous next descriptor to current */ |
974 | prev = list_last_entry(&desc->segments, | 974 | if (!list_empty(&desc->segments)) { |
975 | struct xilinx_vdma_tx_segment, node); | 975 | prev = list_last_entry(&desc->segments, |
976 | prev->hw.next_desc = segment->phys; | 976 | struct xilinx_vdma_tx_segment, node); |
977 | prev->hw.next_desc = segment->phys; | ||
978 | } | ||
977 | 979 | ||
978 | /* Insert the segment into the descriptor segments list. */ | 980 | /* Insert the segment into the descriptor segments list. */ |
979 | list_add_tail(&segment->node, &desc->segments); | 981 | list_add_tail(&segment->node, &desc->segments); |