* [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed
@ 2016-08-15 7:47 Roger Quadros
2016-08-15 15:22 ` Boris Brezillon
0 siblings, 1 reply; 3+ messages in thread
From: Roger Quadros @ 2016-08-15 7:47 UTC (permalink / raw)
To: boris.brezillon
Cc: dan.carpenter, richard, computersforpeace, fcooper, linux-mtd,
linux-kernel, Roger Quadros
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: de3bfc4a1616: ("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>
---
drivers/mtd/nand/omap2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index a59361c..5513bfd9 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -2169,7 +2169,7 @@ scan_tail:
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed
2016-08-15 7:47 [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed Roger Quadros
@ 2016-08-15 15:22 ` Boris Brezillon
2016-08-29 19:57 ` Brian Norris
0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2016-08-15 15:22 UTC (permalink / raw)
To: Roger Quadros
Cc: dan.carpenter, richard, computersforpeace, fcooper, linux-mtd,
linux-kernel
On Mon, 15 Aug 2016 10:47:39 +0300
Roger Quadros <rogerq@ti.com> wrote:
> 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: de3bfc4a1616: ("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>
Brian, can you apply this fix directly?
> ---
> drivers/mtd/nand/omap2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
> index a59361c..5513bfd9 100644
> --- a/drivers/mtd/nand/omap2.c
> +++ b/drivers/mtd/nand/omap2.c
> @@ -2169,7 +2169,7 @@ scan_tail:
> 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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed
2016-08-15 15:22 ` Boris Brezillon
@ 2016-08-29 19:57 ` Brian Norris
0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2016-08-29 19:57 UTC (permalink / raw)
To: Boris Brezillon
Cc: Roger Quadros, dan.carpenter, richard, fcooper, linux-mtd, linux-kernel
On Mon, Aug 15, 2016 at 05:22:00PM +0200, Boris Brezillon wrote:
> On Mon, 15 Aug 2016 10:47:39 +0300
> Roger Quadros <rogerq@ti.com> wrote:
>
> > 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: de3bfc4a1616: ("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>
>
> Brian, can you apply this fix directly?
Applied to linux-mtd.git
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-29 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-15 7:47 [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed Roger Quadros
2016-08-15 15:22 ` Boris Brezillon
2016-08-29 19:57 ` Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).