All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
@ 2021-08-21  7:58 ` Christophe JAILLET
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2021-08-21  7:58 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, boris.brezillon, lee.jones,
	segher, dwmw2
  Cc: linux-mtd, linux-kernel, kernel-janitors, Christophe JAILLET

A successful 'init_rs_non_canonical()' call should be balanced by a
corresponding 'free_rs()' call in the error handling path of the probe, as
already done in the remove function.

Update the error handling path accordingly.

Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/mtd/nand/raw/cafe_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
index d0e8ffd55c22..cba2eaddb0fc 100644
--- a/drivers/mtd/nand/raw/cafe_nand.c
+++ b/drivers/mtd/nand/raw/cafe_nand.c
@@ -751,7 +751,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 			  "CAFE NAND", mtd);
 	if (err) {
 		dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
-		goto out_ior;
+		goto our_free_rs;
 	}
 
 	/* Disable master reset, enable NAND clock */
@@ -795,6 +795,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 	/* Disable NAND IRQ in global IRQ mask register */
 	cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
 	free_irq(pdev->irq, mtd);
+ our_free_rs:
+	free_rs(cafe->rs);
  out_ior:
 	pci_iounmap(pdev, cafe->mmio);
  out_free_mtd:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
@ 2021-08-21  7:58 ` Christophe JAILLET
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2021-08-21  7:58 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, boris.brezillon, lee.jones,
	segher, dwmw2
  Cc: linux-mtd, linux-kernel, kernel-janitors, Christophe JAILLET

A successful 'init_rs_non_canonical()' call should be balanced by a
corresponding 'free_rs()' call in the error handling path of the probe, as
already done in the remove function.

Update the error handling path accordingly.

Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/mtd/nand/raw/cafe_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/cafe_nand.c b/drivers/mtd/nand/raw/cafe_nand.c
index d0e8ffd55c22..cba2eaddb0fc 100644
--- a/drivers/mtd/nand/raw/cafe_nand.c
+++ b/drivers/mtd/nand/raw/cafe_nand.c
@@ -751,7 +751,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 			  "CAFE NAND", mtd);
 	if (err) {
 		dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
-		goto out_ior;
+		goto our_free_rs;
 	}
 
 	/* Disable master reset, enable NAND clock */
@@ -795,6 +795,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 	/* Disable NAND IRQ in global IRQ mask register */
 	cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
 	free_irq(pdev->irq, mtd);
+ our_free_rs:
+	free_rs(cafe->rs);
  out_ior:
 	pci_iounmap(pdev, cafe->mmio);
  out_free_mtd:
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
  2021-08-21  7:58 ` Christophe JAILLET
@ 2021-08-23  8:35   ` Miquel Raynal
  -1 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2021-08-23  8:35 UTC (permalink / raw)
  To: Christophe JAILLET, miquel.raynal, richard, vigneshr,
	boris.brezillon, lee.jones, segher, dwmw2
  Cc: linux-mtd, linux-kernel, kernel-janitors

On Sat, 2021-08-21 at 07:58:45 UTC, Christophe JAILLET wrote:
> A successful 'init_rs_non_canonical()' call should be balanced by a
> corresponding 'free_rs()' call in the error handling path of the probe, as
> already done in the remove function.
> 
> Update the error handling path accordingly.
> 
> Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
@ 2021-08-23  8:35   ` Miquel Raynal
  0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2021-08-23  8:35 UTC (permalink / raw)
  To: Christophe JAILLET, miquel.raynal, richard, vigneshr,
	boris.brezillon, lee.jones, segher, dwmw2
  Cc: linux-mtd, linux-kernel, kernel-janitors

On Sat, 2021-08-21 at 07:58:45 UTC, Christophe JAILLET wrote:
> A successful 'init_rs_non_canonical()' call should be balanced by a
> corresponding 'free_rs()' call in the error handling path of the probe, as
> already done in the remove function.
> 
> Update the error handling path accordingly.
> 
> Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
       [not found]   ` <332872880.718.1629708519896.JavaMail.www@wwinf1d09>
@ 2021-08-23  8:59     ` Miquel Raynal
  0 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2021-08-23  8:59 UTC (permalink / raw)
  To: Marion et Christophe JAILLET, linux-mtd

Hi Christophe,

+ML

Marion et Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote on
Mon, 23 Aug 2021 10:48:39 +0200 (CEST):

> Hi,
> 
> just noticed a typo in my patch : s/our/out/ in the label 
> 
> Can you fix it before it leaves your tree?

Yep, done!

> 
> CJ
> 
>  
> 
>  
> 
> > Message du 23/08/21 10:35
> > De : "Miquel Raynal" 
> > A : "Christophe JAILLET" , miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, boris.brezillon@collabora.com, lee.jones@linaro.org, segher@kernel.crashing.org, dwmw2@infradead.org
> > Copie à : linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
> > Objet : Re: [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()'
> > 
> > On Sat, 2021-08-21 at 07:58:45 UTC, Christophe JAILLET wrote:  
> > > A successful 'init_rs_non_canonical()' call should be balanced by a
> > > corresponding 'free_rs()' call in the error handling path of the probe, as
> > > already done in the remove function.
> > > 
> > > Update the error handling path accordingly.
> > > 
> > > Fixes: 8c61b7a7f4d4 ("[MTD] [NAND] Use rslib for CAFÉ ECC")
> > > Signed-off-by: Christophe JAILLET   
> > 
> > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
> > 
> > Miquel
> >  

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-23  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21  7:58 [PATCH] mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()' Christophe JAILLET
2021-08-21  7:58 ` Christophe JAILLET
2021-08-23  8:35 ` Miquel Raynal
2021-08-23  8:35   ` Miquel Raynal
     [not found]   ` <332872880.718.1629708519896.JavaMail.www@wwinf1d09>
2021-08-23  8:59     ` Miquel Raynal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.