Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1462607 > unrolled thread
| Started by | Roger Quadros <rogerq@ti.com> |
|---|---|
| First post | 2016-08-15 09:50 +0200 |
| Last post | 2016-08-15 17:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed Roger Quadros <rogerq@ti.com> - 2016-08-15 09:50 +0200
Re: [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-08-15 17:30 +0200
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-08-15 09:50 +0200 |
| Subject | [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed |
| Message-ID | <s6kOJ-2Gt-1@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-08-15 17:30 +0200 |
| Subject | Re: [PATCH] mtd: nand: omap2: Don't call dma_release_channel() if dma_request_chan() failed |
| Message-ID | <s6rZU-7hs-21@gated-at.bofh.it> |
| In reply to | #1462607 |
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);
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web