提交 a93295a7 编写于 作者: R Roger Quadros 提交者: Brian Norris

mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed

dma_request_chan() can fail returning an error pointer. In this case
prevent calling dma_release_channel() to prevent a ERR_PTR() dereference.

As error path can be called even with no DMA configuration, info->dma can
be NULL so don't call dma_release_channel() for that case either.

Fixes: de3bfc4a: ("mtd: nand: omap2: fix return value check in omap_nand_probe()")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NRoger Quadros <rogerq@ti.com>
Acked-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
上级 29b4817d
......@@ -2169,7 +2169,7 @@ static int omap_nand_probe(struct platform_device *pdev)
return 0;
return_error:
if (info->dma)
if (!IS_ERR_OR_NULL(info->dma))
dma_release_channel(info->dma);
if (nand_chip->ecc.priv) {
nand_bch_free(nand_chip->ecc.priv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册