linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	<linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: nand: sh_flctl: handle dma_submit() errors
Date: Sun, 14 Aug 2016 17:50:29 +0200	[thread overview]
Message-ID: <20160814175029.29b03b4a@bbrezillon> (raw)
In-Reply-To: <1462477364-19529-1-git-send-email-computersforpeace@gmail.com>

On Thu,  5 May 2016 12:42:44 -0700
Brian Norris <computersforpeace@gmail.com> wrote:

> Some build tools noticed that 'cookie' is being set but not used. Might
> as well catch the errors here and handle them the same way we handle
> other DMA prep steps.
> 

Applied. I know it's only been compile tested, and even if nobody
acked/reviewed/tested it, it seems to be correct.
Let's see if someone complains about a regression (the commit will be in
-next for the whole 4.8-rc cycle).

Thanks,

Boris

> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> Compile tested only
> 
>  drivers/mtd/nand/sh_flctl.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
> index 6fa3bcd59769..442ce619b3b6 100644
> --- a/drivers/mtd/nand/sh_flctl.c
> +++ b/drivers/mtd/nand/sh_flctl.c
> @@ -397,7 +397,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
>  	struct dma_chan *chan;
>  	enum dma_transfer_direction tr_dir;
>  	dma_addr_t dma_addr;
> -	dma_cookie_t cookie = -EINVAL;
> +	dma_cookie_t cookie;
>  	uint32_t reg;
>  	int ret;
>  
> @@ -423,6 +423,12 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
>  		desc->callback = flctl_dma_complete;
>  		desc->callback_param = flctl;
>  		cookie = dmaengine_submit(desc);
> +		if (dma_submit_error(cookie)) {
> +			ret = dma_submit_error(cookie);
> +			dev_warn(&flctl->pdev->dev,
> +				 "DMA submit failed, falling back to PIO\n");
> +			goto out;
> +		}
>  
>  		dma_async_issue_pending(chan);
>  	} else {

      reply	other threads:[~2016-08-14 15:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 19:42 [PATCH] mtd: nand: sh_flctl: handle dma_submit() errors Brian Norris
2016-08-14 15:50 ` Boris Brezillon [this message]

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=20160814175029.29b03b4a@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    /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).