From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752956AbcHNPuc (ORCPT ); Sun, 14 Aug 2016 11:50:32 -0400 Received: from down.free-electrons.com ([37.187.137.238]:51540 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752842AbcHNPub (ORCPT ); Sun, 14 Aug 2016 11:50:31 -0400 Date: Sun, 14 Aug 2016 17:50:29 +0200 From: Boris Brezillon To: Brian Norris Cc: Richard Weinberger , , Subject: Re: [PATCH] mtd: nand: sh_flctl: handle dma_submit() errors Message-ID: <20160814175029.29b03b4a@bbrezillon> In-Reply-To: <1462477364-19529-1-git-send-email-computersforpeace@gmail.com> References: <1462477364-19529-1-git-send-email-computersforpeace@gmail.com> Organization: Free Electrons X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 May 2016 12:42:44 -0700 Brian Norris 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 > --- > 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 {