diff mbox

[-next] mtd: nand: sunxi: fix return value check in sunxi_nfc_dma_op_prepare()

Message ID 1465828038-16893-1-git-send-email-weiyj_lk@163.com
State Accepted
Commit 28f3d01eca5269b01e33c1bf976d90c33b546ad9
Headers show

Commit Message

weiyj_lk@163.com June 13, 2016, 2:27 p.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

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>
---
 drivers/mtd/nand/sunxi_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Boris Brezillon June 13, 2016, 8:06 p.m. UTC | #1
On Mon, 13 Jun 2016 14:27:18 +0000
weiyj_lk@163.com wrote:

> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> 
> 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>

Applied.

Thanks,

Boris

> ---
>  drivers/mtd/nand/sunxi_nand.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
> index ef7f6df..653cb3a 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;
>  	}
> 
>
diff mbox

Patch

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index ef7f6df..653cb3a 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;
 	}