Patchwork mtd: nand: mxc_nand: Check the return value from clk_prepare_enable()

login
register
mail settings
Submitter Fabio Estevam
Date Dec. 2, 2013, 2:50 a.m.
Message ID <1385952602-20977-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/295759/
State Accepted
Commit dcedf628f55ccdb34c8783a03bed9382bb5e1a82
Headers show

Comments

Fabio Estevam - Dec. 2, 2013, 2:50 a.m.
From: Fabio Estevam <fabio.estevam@freescale.com>

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mtd/nand/mxc_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Brian Norris - Dec. 4, 2013, 9:59 p.m.
On Mon, Dec 02, 2013 at 12:50:02AM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> clk_prepare_enable() may fail, so let's check its return value and propagate it
> in the case of error.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Pushed to l2-mtd.git. Thanks!

Brian

Patch

diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 9dfdb06..0c09b8b 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -1512,7 +1512,9 @@  static int mxcnd_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	clk_prepare_enable(host->clk);
+	err = clk_prepare_enable(host->clk);
+	if (err)
+		return err;
 	host->clk_act = 1;
 
 	/*