Skip to contentSkip to conversation

mtd : fsl-quadspi: Let the clocks error path be clearer

PATCH Applied Fabio Estevam 3 participants 3 messages Oct 17, 2014 – Oct 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd : fsl-quadspi: Let the clocks error path be clearer

From: Fabio Estevam <[email protected]>

When clk_prepare_enable(q->clk) fails it is clearer to disable the previous acquired clock (q->clk_en) in the error path rather than doing it locally.

So disable q->clk_en in the error path only.

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/fsl-quadspi.c +2 -2
index e1c517d..8006f26 100644
@@ -843,9 +843,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 
 	ret = clk_prepare_enable(q->clk);
 	if (ret) {
-		clk_disable_unprepare(q->clk_en);
 		dev_err(dev, "can not enable the qspi clock\n");
-		goto map_failed;
+		goto clk_failed;
 	}
 
 	/* find the irq */
@@ -966,6 +965,7 @@ last_init_failed:
 
 irq_failed:
 	clk_disable_unprepare(q->clk);
+clk_failed:
 	clk_disable_unprepare(q->clk_en);
 map_failed:
 	dev_err(dev, "Freescale QuadSPI probe failed\n");
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 37 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

When clk_prepare_enable(q->clk) fails it is clearer to disable the previous acquired clock (q->clk_en) in the error path rather than doing it locally.

So disable q->clk_en in the error path only.

---
 drivers/mtd/spi-nor/fsl-quadspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/fsl-quadspi.c +2 -2
index e1c517d..8006f26 100644
@@ -843,9 +843,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 
 	ret = clk_prepare_enable(q->clk);
 	if (ret) {
-		clk_disable_unprepare(q->clk_en);
 		dev_err(dev, "can not enable the qspi clock\n");
-		goto map_failed;
+		goto clk_failed;
 	}
 
 	/* find the irq */
@@ -966,6 +965,7 @@ last_init_failed:
 
 irq_failed:
 	clk_disable_unprepare(q->clk);
+clk_failed:
 	clk_disable_unprepare(q->clk_en);
 map_failed:
 	dev_err(dev, "Freescale QuadSPI probe failed\n");
Signature · 1 line
1.9.1