linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get
@ 2021-12-30  7:27 Miaoqian Lin
  2022-01-03 11:32 ` Paul Cercueil
  2022-01-23 15:23 ` Miquel Raynal
  0 siblings, 2 replies; 4+ messages in thread
From: Miaoqian Lin @ 2021-12-30  7:27 UTC (permalink / raw)
  Cc: linmq006, Paul Cercueil, Harvey Hunt, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra, linux-mips, linux-mtd,
	linux-kernel

If of_find_device_by_node() succeeds, ingenic_ecc_get() doesn't have
a corresponding put_device(). Thus add put_device() to fix the exception
handling.

Fixes: 15de8c6 ("mtd: rawnand: ingenic: Separate top-level and SoC specific code")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/mtd/nand/raw/ingenic/ingenic_ecc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
index efe0ffe4f1ab..9054559e52dd 100644
--- a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
+++ b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
@@ -68,9 +68,14 @@ static struct ingenic_ecc *ingenic_ecc_get(struct device_node *np)
 	struct ingenic_ecc *ecc;
 
 	pdev = of_find_device_by_node(np);
-	if (!pdev || !platform_get_drvdata(pdev))
+	if (!pdev)
 		return ERR_PTR(-EPROBE_DEFER);
 
+	if (!platform_get_drvdata(pdev)) {
+		put_device(&pdev->dev);
+		return ERR_PTR(-EPROBE_DEFER);
+	}
+
 	ecc = platform_get_drvdata(pdev);
 	clk_prepare_enable(ecc->clk);
 
-- 
2.17.1


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

* Re: [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get
  2021-12-30  7:27 [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get Miaoqian Lin
@ 2022-01-03 11:32 ` Paul Cercueil
  2022-01-23 15:23 ` Miquel Raynal
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Cercueil @ 2022-01-03 11:32 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Harvey Hunt, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, linux-mips, linux-mtd, linux-kernel

Hi,

Le jeu., déc. 30 2021 at 07:27:51 +0000, Miaoqian Lin 
<linmq006@gmail.com> a écrit :
> If of_find_device_by_node() succeeds, ingenic_ecc_get() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the 
> exception
> handling.
> 
> Fixes: 15de8c6 ("mtd: rawnand: ingenic: Separate top-level and SoC 
> specific code")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Reviewed-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/mtd/nand/raw/ingenic/ingenic_ecc.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c 
> b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
> index efe0ffe4f1ab..9054559e52dd 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
> @@ -68,9 +68,14 @@ static struct ingenic_ecc *ingenic_ecc_get(struct 
> device_node *np)
>  	struct ingenic_ecc *ecc;
> 
>  	pdev = of_find_device_by_node(np);
> -	if (!pdev || !platform_get_drvdata(pdev))
> +	if (!pdev)
>  		return ERR_PTR(-EPROBE_DEFER);
> 
> +	if (!platform_get_drvdata(pdev)) {
> +		put_device(&pdev->dev);
> +		return ERR_PTR(-EPROBE_DEFER);
> +	}
> +
>  	ecc = platform_get_drvdata(pdev);
>  	clk_prepare_enable(ecc->clk);
> 
> --
> 2.17.1
> 



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

* Re: [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get
  2021-12-30  7:27 [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get Miaoqian Lin
  2022-01-03 11:32 ` Paul Cercueil
@ 2022-01-23 15:23 ` Miquel Raynal
  2022-01-23 15:31   ` Miquel Raynal
  1 sibling, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2022-01-23 15:23 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Miquel Raynal, Paul Cercueil, Harvey Hunt, Richard Weinberger,
	Vignesh Raghavendra, linux-mips, linux-mtd, linux-kernel

On Thu, 2021-12-30 at 07:27:51 UTC, Miaoqian Lin wrote:
> If of_find_device_by_node() succeeds, ingenic_ecc_get() doesn't have
> a corresponding put_device(). Thus add put_device() to fix the exception
> handling.
> 
> Fixes: 15de8c6 ("mtd: rawnand: ingenic: Separate top-level and SoC specific code")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> Reviewed-by: Paul Cercueil <paul@crapouillou.net>

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

Miquel

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

* Re: [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get
  2022-01-23 15:23 ` Miquel Raynal
@ 2022-01-23 15:31   ` Miquel Raynal
  0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2022-01-23 15:31 UTC (permalink / raw)
  To: Miaoqian Lin
  Cc: Paul Cercueil, Harvey Hunt, Richard Weinberger,
	Vignesh Raghavendra, linux-mips, linux-mtd, linux-kernel


miquel.raynal@bootlin.com wrote on Sun, 23 Jan 2022 16:23:32 +0100:

> On Thu, 2021-12-30 at 07:27:51 UTC, Miaoqian Lin wrote:
> > If of_find_device_by_node() succeeds, ingenic_ecc_get() doesn't have
> > a corresponding put_device(). Thus add put_device() to fix the exception
> > handling.
> > 
> > Fixes: 15de8c6 ("mtd: rawnand: ingenic: Separate top-level and SoC specific code")
> > Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> > Reviewed-by: Paul Cercueil <paul@crapouillou.net>  
> 
> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Pushed on mtd/fixes, actually.

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

end of thread, other threads:[~2022-01-23 15:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30  7:27 [PATCH] mtd: rawnand: ingenic: Fix missing put_device in ingenic_ecc_get Miaoqian Lin
2022-01-03 11:32 ` Paul Cercueil
2022-01-23 15:23 ` Miquel Raynal
2022-01-23 15:31   ` Miquel Raynal

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).