mtd: nand: sunxi: fix return value check in sunxi_nfc_dma_op_prepare()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 13 Jun 2016 14:27:18 +0000 (14:27 +0000)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Mon, 11 Jul 2016 06:39:53 +0000 (08:39 +0200)
In case of error, the function dmaengine_prep_slave_sg() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Fixes: 614049a8d904 ("mtd: nand: sunxi: add support for DMA assisted operations")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/sunxi_nand.c

index ef7f6df..653cb3a 100644 (file)
@@ -390,8 +390,8 @@ static int sunxi_nfc_dma_op_prepare(struct mtd_info *mtd, const void *buf,
                return -ENOMEM;
 
        dmad = dmaengine_prep_slave_sg(nfc->dmac, sg, 1, tdir, DMA_CTRL_ACK);
-       if (IS_ERR(dmad)) {
-               ret = PTR_ERR(dmad);
+       if (!dmad) {
+               ret = -EINVAL;
                goto err_unmap_buf;
        }