diff options
author | Raag Jadav <raagjadav@gmail.com> | 2019-06-29 11:20:48 +0300 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2019-07-07 20:16:43 +0300 |
commit | b7f5b656ffe19e3c65f04e3adeae21ac17227126 (patch) | |
tree | a258fa32196a092826f42d0a500725453fe5a63e /drivers/dma/at_xdmac.c | |
parent | 9dcb98a29b6e81394fa33ca984f3aaad4d0d1393 (diff) | |
download | linux-b7f5b656ffe19e3c65f04e3adeae21ac17227126.tar.xz |
dmaengine: at_xdmac: check for non-empty xfers_list before invoking callback
tx descriptor retrieved from an empty xfers_list may not have valid
pointers to the callback functions.
Avoid calling dmaengine_desc_get_callback_invoke if xfers_list is empty.
Signed-off-by: Raag Jadav <raagjadav@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/at_xdmac.c')
-rw-r--r-- | drivers/dma/at_xdmac.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index e4ae2ee46d3f..84b3c6ac31cc 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1579,11 +1579,14 @@ static void at_xdmac_handle_cyclic(struct at_xdmac_chan *atchan) struct at_xdmac_desc *desc; struct dma_async_tx_descriptor *txd; - desc = list_first_entry(&atchan->xfers_list, struct at_xdmac_desc, xfer_node); - txd = &desc->tx_dma_desc; + if (!list_empty(&atchan->xfers_list)) { + desc = list_first_entry(&atchan->xfers_list, + struct at_xdmac_desc, xfer_node); + txd = &desc->tx_dma_desc; - if (txd->flags & DMA_PREP_INTERRUPT) - dmaengine_desc_get_callback_invoke(txd, NULL); + if (txd->flags & DMA_PREP_INTERRUPT) + dmaengine_desc_get_callback_invoke(txd, NULL); + } } static void at_xdmac_handle_error(struct at_xdmac_chan *atchan) |