linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: lpc32xx_mlc: Fix an error handling path in lpc32xx_nand_probe()
@ 2017-09-03 11:58 Christophe JAILLET
  2017-09-19 20:13 ` Boris Brezillon
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-09-03 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

If 'clk_prepare_enable()' fails, we must 'put' the corresponding clock.

Fixes: 4d26f012ab59 ("mtd: nand: lpc32xx_mlc: Handle return value of clk_prepare_enable.")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Labels in the error handling path could be renamed, but it does not worth
the effort, IMHO.
---
 drivers/mtd/nand/lpc32xx_mlc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
index c3bb358ef01e..5f72a824e67d 100644
--- a/drivers/mtd/nand/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/lpc32xx_mlc.c
@@ -707,7 +707,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 	}
 	res = clk_prepare_enable(host->clk);
 	if (res)
-		goto err_exit1;
+		goto err_put_clk;
 
 	nand_chip->cmd_ctrl = lpc32xx_nand_cmd_ctrl;
 	nand_chip->dev_ready = lpc32xx_nand_device_ready;
@@ -814,6 +814,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 		dma_release_channel(host->dma_chan);
 err_exit2:
 	clk_disable_unprepare(host->clk);
+err_put_clk:
 	clk_put(host->clk);
 err_exit1:
 	lpc32xx_wp_enable(host);
-- 
2.11.0

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

* [PATCH] mtd: nand: lpc32xx_mlc: Fix an error handling path in lpc32xx_nand_probe()
  2017-09-03 11:58 [PATCH] mtd: nand: lpc32xx_mlc: Fix an error handling path in lpc32xx_nand_probe() Christophe JAILLET
@ 2017-09-19 20:13 ` Boris Brezillon
  0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2017-09-19 20:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun,  3 Sep 2017 13:58:31 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> If 'clk_prepare_enable()' fails, we must 'put' the corresponding clock.
> 
> Fixes: 4d26f012ab59 ("mtd: nand: lpc32xx_mlc: Handle return value of clk_prepare_enable.")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied.

Thanks,

Boris

> ---
> Labels in the error handling path could be renamed, but it does not worth
> the effort, IMHO.
> ---
>  drivers/mtd/nand/lpc32xx_mlc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c
> index c3bb358ef01e..5f72a824e67d 100644
> --- a/drivers/mtd/nand/lpc32xx_mlc.c
> +++ b/drivers/mtd/nand/lpc32xx_mlc.c
> @@ -707,7 +707,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
>  	}
>  	res = clk_prepare_enable(host->clk);
>  	if (res)
> -		goto err_exit1;
> +		goto err_put_clk;
>  
>  	nand_chip->cmd_ctrl = lpc32xx_nand_cmd_ctrl;
>  	nand_chip->dev_ready = lpc32xx_nand_device_ready;
> @@ -814,6 +814,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
>  		dma_release_channel(host->dma_chan);
>  err_exit2:
>  	clk_disable_unprepare(host->clk);
> +err_put_clk:
>  	clk_put(host->clk);
>  err_exit1:
>  	lpc32xx_wp_enable(host);

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

end of thread, other threads:[~2017-09-19 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-03 11:58 [PATCH] mtd: nand: lpc32xx_mlc: Fix an error handling path in lpc32xx_nand_probe() Christophe JAILLET
2017-09-19 20:13 ` Boris Brezillon

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