mtd: nand: sh_flctl: use dma_mapping_error to check map errors
authorPan Bian <bianpan2016@163.com>
Tue, 8 Aug 2017 14:35:42 +0000 (22:35 +0800)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Wed, 23 Aug 2017 14:49:22 +0000 (16:49 +0200)
The return value of dma_map_single() should be checked by
dma_mapping_error(). However, in function flctl_dma_fifo0_transfer(), its
return value is checked against NULL, which could result in failures.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/sh_flctl.c

index 891ac7b993050d7d8f5f92d51fe2c37bdf96d1c0..2404d6634bda8c8eb678ad69b6f80842f58466d9 100644 (file)
@@ -411,7 +411,7 @@ static int flctl_dma_fifo0_transfer(struct sh_flctl *flctl, unsigned long *buf,
 
        dma_addr = dma_map_single(chan->device->dev, buf, len, dir);
 
-       if (dma_addr)
+       if (!dma_mapping_error(chan->device->dev, dma_addr))
                desc = dmaengine_prep_slave_single(chan, dma_addr, len,
                        tr_dir, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);