mtd: nand: omap2: fix return value check in omap_nand_probe()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Aug 1 18:59:08 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=de3bfc4a16165cfc5f1504981f836d39a5f39a64
Commit:     de3bfc4a16165cfc5f1504981f836d39a5f39a64
Parent:     1ed106914abdd6d73f7efba333cd6e044c59b316
Author:     Wei Yongjun <yongjun_wei at trendmicro.com.cn>
AuthorDate: Thu Jul 14 12:06:45 2016 +0000
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jul 15 17:10:46 2016 -0700

    mtd: nand: omap2: fix return value check in omap_nand_probe()
    
    In case of error, the function dma_request_chan() returns ERR_PTR() and
    never returns NULL. The NULL test in the return value check should be
    replaced with IS_ERR().
    
    Fixes: aa7abd312c11 ('mtd: nand: omap2: Support parsing dma channel
    information from DT')
    Signed-off-by: Wei Yongjun <yongjun_wei at trendmicro.com.cn>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/omap2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 83b9091..3dfd512 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1920,9 +1920,9 @@ static int omap_nand_probe(struct platform_device *pdev)
 		dma_cap_set(DMA_SLAVE, mask);
 		info->dma = dma_request_chan(pdev->dev.parent, "rxtx");
 
-		if (!info->dma) {
+		if (IS_ERR(info->dma)) {
 			dev_err(&pdev->dev, "DMA engine request failed\n");
-			err = -ENXIO;
+			err = PTR_ERR(info->dma);
 			goto return_error;
 		} else {
 			struct dma_slave_config cfg;



More information about the linux-mtd-cvs mailing list