All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: gpmi: disable the clocks on errors
@ 2016-10-22 16:15 Fabio Estevam
  2016-10-23  3:08 ` Marek Vasut
  2016-10-24 12:31 ` Boris Brezillon
  0 siblings, 2 replies; 5+ messages in thread
From: Fabio Estevam @ 2016-10-22 16:15 UTC (permalink / raw)
  To: boris.brezillon; +Cc: han.xu, linux-mtd, Fabio Estevam

From: Fabio Estevam <fabio.estevam@nxp.com>

We should disable the previously enabled GPMI clocks in the error paths.

Also, when gpmi_enable_clk() fails simply return the error
code immediately rather than jumping to to the 'err_out' label.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
index 0f68a99..141bd70 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
@@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
 
 	ret = gpmi_enable_clk(this);
 	if (ret)
-		goto err_out;
+		return ret;
 	ret = gpmi_reset_block(r->gpmi_regs, false);
 	if (ret)
 		goto err_out;
@@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
 	gpmi_disable_clk(this);
 	return 0;
 err_out:
+	gpmi_disable_clk(this);
 	return ret;
 }
 
@@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
 
 	ret = gpmi_enable_clk(this);
 	if (ret)
-		goto err_out;
+		return ret;
 
 	/*
 	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
@@ -308,6 +309,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
 	gpmi_disable_clk(this);
 	return 0;
 err_out:
+	gpmi_disable_clk(this);
 	return ret;
 }
 
-- 
2.7.4

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

* Re: [PATCH] mtd: nand: gpmi: disable the clocks on errors
  2016-10-22 16:15 [PATCH] mtd: nand: gpmi: disable the clocks on errors Fabio Estevam
@ 2016-10-23  3:08 ` Marek Vasut
  2016-10-24 14:49   ` Han Xu
  2016-10-24 12:31 ` Boris Brezillon
  1 sibling, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2016-10-23  3:08 UTC (permalink / raw)
  To: Fabio Estevam, boris.brezillon; +Cc: Fabio Estevam, han.xu, linux-mtd

On 10/22/2016 06:15 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> We should disable the previously enabled GPMI clocks in the error paths.
> 
> Also, when gpmi_enable_clk() fails simply return the error
> code immediately rather than jumping to to the 'err_out' label.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Reviewed-by: Marek Vasut <marex@denx.de>

> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> index 0f68a99..141bd70 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> @@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
>  
>  	ret = gpmi_enable_clk(this);
>  	if (ret)
> -		goto err_out;
> +		return ret;
>  	ret = gpmi_reset_block(r->gpmi_regs, false);
>  	if (ret)
>  		goto err_out;
> @@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
>  	gpmi_disable_clk(this);
>  	return 0;
>  err_out:
> +	gpmi_disable_clk(this);
>  	return ret;
>  }
>  
> @@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
>  
>  	ret = gpmi_enable_clk(this);
>  	if (ret)
> -		goto err_out;
> +		return ret;
>  
>  	/*
>  	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
> @@ -308,6 +309,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
>  	gpmi_disable_clk(this);
>  	return 0;
>  err_out:
> +	gpmi_disable_clk(this);
>  	return ret;
>  }
>  
> 


-- 
Best regards,
Marek Vasut

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

* Re: [PATCH] mtd: nand: gpmi: disable the clocks on errors
  2016-10-22 16:15 [PATCH] mtd: nand: gpmi: disable the clocks on errors Fabio Estevam
  2016-10-23  3:08 ` Marek Vasut
@ 2016-10-24 12:31 ` Boris Brezillon
  2016-10-24 13:14   ` Fabio Estevam
  1 sibling, 1 reply; 5+ messages in thread
From: Boris Brezillon @ 2016-10-24 12:31 UTC (permalink / raw)
  To: Fabio Estevam, Fabio Estevam; +Cc: han.xu, linux-mtd

On Sat, 22 Oct 2016 14:15:22 -0200
Fabio Estevam <festevam@gmail.com> wrote:

> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> We should disable the previously enabled GPMI clocks in the error paths.
> 
> Also, when gpmi_enable_clk() fails simply return the error
> code immediately rather than jumping to to the 'err_out' label.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Brian, can you take this patch in the MTD tree and queue it for the
next -rc?

> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> index 0f68a99..141bd70 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> @@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
>  
>  	ret = gpmi_enable_clk(this);
>  	if (ret)
> -		goto err_out;
> +		return ret;
>  	ret = gpmi_reset_block(r->gpmi_regs, false);
>  	if (ret)
>  		goto err_out;
> @@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
>  	gpmi_disable_clk(this);
>  	return 0;
>  err_out:
> +	gpmi_disable_clk(this);
>  	return ret;
>  }
>  
> @@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
>  
>  	ret = gpmi_enable_clk(this);
>  	if (ret)
> -		goto err_out;
> +		return ret;
>  
>  	/*
>  	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
> @@ -308,6 +309,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
>  	gpmi_disable_clk(this);
>  	return 0;
>  err_out:
> +	gpmi_disable_clk(this);
>  	return ret;
>  }
>  

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

* Re: [PATCH] mtd: nand: gpmi: disable the clocks on errors
  2016-10-24 12:31 ` Boris Brezillon
@ 2016-10-24 13:14   ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2016-10-24 13:14 UTC (permalink / raw)
  To: Boris Brezillon; +Cc: Fabio Estevam, han.xu, linux-mtd, Brian Norris

[Adding Brian on Cc]

On Mon, Oct 24, 2016 at 10:31 AM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Sat, 22 Oct 2016 14:15:22 -0200
> Fabio Estevam <festevam@gmail.com> wrote:
>
>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> We should disable the previously enabled GPMI clocks in the error paths.
>>
>> Also, when gpmi_enable_clk() fails simply return the error
>> code immediately rather than jumping to to the 'err_out' label.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>
> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>
> Brian, can you take this patch in the MTD tree and queue it for the
> next -rc?

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

* Re: [PATCH] mtd: nand: gpmi: disable the clocks on errors
  2016-10-23  3:08 ` Marek Vasut
@ 2016-10-24 14:49   ` Han Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Han Xu @ 2016-10-24 14:49 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Fabio Estevam, boris.brezillon, Fabio Estevam, han.xu, linux-mtd

On Sun, Oct 23, 2016 at 05:08:19AM +0200, Marek Vasut wrote:
> On 10/22/2016 06:15 PM, Fabio Estevam wrote:
> > From: Fabio Estevam <fabio.estevam@nxp.com>
> > 
> > We should disable the previously enabled GPMI clocks in the error paths.
> > 
> > Also, when gpmi_enable_clk() fails simply return the error
> > code immediately rather than jumping to to the 'err_out' label.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> 
> Reviewed-by: Marek Vasut <marex@denx.de>
> 

Acked-by: Han Xu<han.xu@nxp.com>

> > ---
> >  drivers/mtd/nand/gpmi-nand/gpmi-lib.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> > index 0f68a99..141bd70 100644
> > --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> > +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c
> > @@ -161,7 +161,7 @@ int gpmi_init(struct gpmi_nand_data *this)
> >  
> >  	ret = gpmi_enable_clk(this);
> >  	if (ret)
> > -		goto err_out;
> > +		return ret;
> >  	ret = gpmi_reset_block(r->gpmi_regs, false);
> >  	if (ret)
> >  		goto err_out;
> > @@ -197,6 +197,7 @@ int gpmi_init(struct gpmi_nand_data *this)
> >  	gpmi_disable_clk(this);
> >  	return 0;
> >  err_out:
> > +	gpmi_disable_clk(this);
> >  	return ret;
> >  }
> >  
> > @@ -270,7 +271,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
> >  
> >  	ret = gpmi_enable_clk(this);
> >  	if (ret)
> > -		goto err_out;
> > +		return ret;
> >  
> >  	/*
> >  	* Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
> > @@ -308,6 +309,7 @@ int bch_set_geometry(struct gpmi_nand_data *this)
> >  	gpmi_disable_clk(this);
> >  	return 0;
> >  err_out:
> > +	gpmi_disable_clk(this);
> >  	return ret;
> >  }
> >  
> > 
> 
> 
> -- 
> Best regards,
> Marek Vasut
> 
> ______________________________________________________
> 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:[~2016-10-24 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-22 16:15 [PATCH] mtd: nand: gpmi: disable the clocks on errors Fabio Estevam
2016-10-23  3:08 ` Marek Vasut
2016-10-24 14:49   ` Han Xu
2016-10-24 12:31 ` Boris Brezillon
2016-10-24 13:14   ` Fabio Estevam

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.