mtd: nand: omap2: fix return value check in omap_nand_probe()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 14 Jul 2016 12:06:45 +0000 (12:06 +0000)
committerBrian Norris <computersforpeace@gmail.com>
Sat, 16 Jul 2016 00:10:46 +0000 (17:10 -0700)
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@trendmicro.com.cn>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/omap2.c

index 83b9091233d493faca81c1a6e8d3b10d6161e0aa..3dfd512b198b2a7b8d64442009af243dcdf30f6f 100644 (file)
@@ -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;