mtd: nand: sh_flctl: handle dma_submit() errors
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Sat Oct 8 21:59:02 PDT 2016
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=3fe4f900bf3061b3994c56eea497d8a839241277
Commit: 3fe4f900bf3061b3994c56eea497d8a839241277
Parent: d9ca77f0eafabb5495542386777ab2833442089b
Author: Brian Norris <computersforpeace at gmail.com>
AuthorDate: Thu May 5 12:42:44 2016 -0700
Committer: Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Fri Sep 23 09:35:16 2016 +0200
mtd: nand: sh_flctl: handle dma_submit() errors
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.
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
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 6fa3bcd..442ce61 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 {
More information about the linux-mtd-cvs
mailing list