Skip to content

Commit

Permalink
mtd: nand: omap2: Don't call dma_release_channel() if dma_request_cha…
Browse files Browse the repository at this point in the history
…n() 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: de3bfc4: ("mtd: nand: omap2: fix return value check in omap_nand_probe()")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
  • Loading branch information
Roger Quadros authored and computersforpeace committed Aug 29, 2016
1 parent 29b4817 commit a93295a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mtd/nand/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a93295a

Please sign in to comment.