Patchwork [6/7] mtd: nand: pxa3xx: Check for clk_prepare_enable() return value

login
register
mail settings
Submitter Ezequiel Garcia
Date April 17, 2013, 4:38 p.m.
Message ID <1366216694-2365-7-git-send-email-ezequiel.garcia@free-electrons.com>
Download mbox | patch
Permalink /patch/237291/
State Accepted
Commit 1f8eaff2aa75f8ec662e044deecdc91abc780d60
Headers show

Comments

Ezequiel Garcia - April 17, 2013, 4:38 p.m.
clk_prepare_enable() can fail due to unknown reason.
Add a check for this and return the error code if it fails.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
 drivers/mtd/nand/pxa3xx_nand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index c047943..c1b8ec6 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1072,7 +1072,9 @@  static int alloc_nand_resource(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failed to get nand clock\n");
 		return PTR_ERR(info->clk);
 	}
-	clk_prepare_enable(info->clk);
+	ret = clk_prepare_enable(info->clk);
+	if (ret < 0)
+		return ret;
 
 	/*
 	 * This is a dirty hack to make this driver work from devicetree