Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

authored by

Brian Norris and committed by
Boris Brezillon
3fe4f900 d9ca77f0

+7 -1
+7 -1
drivers/mtd/nand/sh_flctl.c
··· 397 397 struct dma_chan *chan; 398 398 enum dma_transfer_direction tr_dir; 399 399 dma_addr_t dma_addr; 400 - dma_cookie_t cookie = -EINVAL; 400 + dma_cookie_t cookie; 401 401 uint32_t reg; 402 402 int ret; 403 403 ··· 423 423 desc->callback = flctl_dma_complete; 424 424 desc->callback_param = flctl; 425 425 cookie = dmaengine_submit(desc); 426 + if (dma_submit_error(cookie)) { 427 + ret = dma_submit_error(cookie); 428 + dev_warn(&flctl->pdev->dev, 429 + "DMA submit failed, falling back to PIO\n"); 430 + goto out; 431 + } 426 432 427 433 dma_async_issue_pending(chan); 428 434 } else {