Skip to contentSkip to conversation

clk: s2mps11: Simplify s2mps11_clk_probe unwind paths

PATCH Superseded Axel Lin 2 participants 2 messages May 18, 2014 – May 19, 2014

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 clk: s2mps11: Simplify s2mps11_clk_probe unwind paths

The devm_clk_unregister() in probe error paths are not necessary as it will be automatically called when probe fails.

---
 drivers/clk/clk-s2mps11.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/clk/clk-s2mps11.c +4 -10
index f2f62a1b..aeaa61c 100644
@@ -210,7 +210,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 					sizeof(struct clk_lookup), GFP_KERNEL);
 		if (!s2mps11_clk->lookup) {
 			ret = -ENOMEM;
-			goto err_lup;
+			goto err_reg;
 		}
 
 		s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk);
@@ -231,16 +231,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, s2mps11_clks);
 
 	return ret;
-err_lup:
-	devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
+
 err_reg:
-	while (s2mps11_clk > s2mps11_clks) {
-		if (s2mps11_clk->lookup) {
-			clkdev_drop(s2mps11_clk->lookup);
-			devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
-		}
-		s2mps11_clk--;
-	}
+	while (--i >= 0)
+		clkdev_drop(s2mps11_clks[i].lookup);
 
 	return ret;
 }
Signature · 1 line
1.8.3.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Axel Lin

The devm_clk_unregister() in probe error paths are not necessary as it will be automatically called when probe fails.

---
 drivers/clk/clk-s2mps11.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

Best regards,
Krzysztof

Quoted 33 lines
drivers/clk/clk-s2mps11.c +4 -10
index f2f62a1b..aeaa61c 100644
@@ -210,7 +210,7 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 					sizeof(struct clk_lookup), GFP_KERNEL);
 		if (!s2mps11_clk->lookup) {
 			ret = -ENOMEM;
-			goto err_lup;
+			goto err_reg;
 		}
 
 		s2mps11_clk->lookup->con_id = s2mps11_name(s2mps11_clk);
@@ -231,16 +231,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, s2mps11_clks);
 
 	return ret;
-err_lup:
-	devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
+
 err_reg:
-	while (s2mps11_clk > s2mps11_clks) {
-		if (s2mps11_clk->lookup) {
-			clkdev_drop(s2mps11_clk->lookup);
-			devm_clk_unregister(&pdev->dev, s2mps11_clk->clk);
-		}
-		s2mps11_clk--;
-	}
+	while (--i >= 0)
+		clkdev_drop(s2mps11_clks[i].lookup);
 
 	return ret;
 }