dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ludovic Desroches <ludovic.desroches@microchip.com>
To: Raag Jadav <raagjadav@gmail.com>
Cc: <dmaengine@vger.kernel.org>, Vinod Koul <vkoul@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: at_xdmac: check for non-empty xfers_list before invoking callback
Date: Mon, 1 Jul 2019 10:00:51 +0200	[thread overview]
Message-ID: <20190701080050.np5krtatlifnvtq5@M43218.corp.atmel.com> (raw)
In-Reply-To: <1561796448-3321-1-git-send-email-raagjadav@gmail.com>

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@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.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
> 
> 

  reply	other threads:[~2019-07-01  8:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-29  8:20 [PATCH] dmaengine: at_xdmac: check for non-empty xfers_list before invoking callback Raag Jadav
2019-07-01  8:00 ` Ludovic Desroches [this message]
2019-07-07 17:17 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190701080050.np5krtatlifnvtq5@M43218.corp.atmel.com \
    --to=ludovic.desroches@microchip.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raagjadav@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).