From: Wei Yongjun Date: Mon, 13 Jun 2016 14:27:18 +0000 (+0000) Subject: mtd: nand: sunxi: fix return value check in sunxi_nfc_dma_op_prepare() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=28f3d01eca5269b01e33c1bf976d90c33b546ad9;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mtd: nand: sunxi: fix return value check in sunxi_nfc_dma_op_prepare() 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 Fixes: 614049a8d904 ("mtd: nand: sunxi: add support for DMA assisted operations") Signed-off-by: Boris Brezillon --- diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c index ef7f6dfde80b..653cb3a06cbe 100644 --- a/drivers/mtd/nand/sunxi_nand.c +++ b/drivers/mtd/nand/sunxi_nand.c @@ -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; }