[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190701080050.np5krtatlifnvtq5@M43218.corp.atmel.com>
Date: Mon, 1 Jul 2019 10:00:51 +0200
From: Ludovic Desroches <ludovic.desroches@...rochip.com>
To: Raag Jadav <raagjadav@...il.com>
CC: <dmaengine@...r.kernel.org>, Vinod Koul <vkoul@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dmaengine: at_xdmac: check for non-empty xfers_list
before invoking callback
On Sat, Jun 29, 2019 at 01:50:48PM +0530, Raag Jadav wrote:
>
> 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@...il.com>
Acked-by: Ludovic Desroches <ludovic.desroches@...rochip.com>
Thanks
> ---
> drivers/dma/at_xdmac.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index 627ef3e..b58ac72 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1568,11 +1568,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)
> --
> 2.7.4
>
>
Powered by blists - more mailing lists