Patchwork [10/13] i2c: sirf: Use devm_clk_get()

login
register
mail settings
Submitter Jingoo Han
Date Dec. 17, 2013, 7 a.m.
Message ID <002e01cefaf5$9b77e320$d267a960$%han@samsung.com>
Download mbox | patch
Permalink /patch/302011/
State Deferred
Headers show

Comments

Jingoo Han - Dec. 17, 2013, 7 a.m.
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/i2c/busses/i2c-sirf.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Patch

diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 6784f7f..c8fcddc 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -284,17 +284,16 @@  static int i2c_sirfsoc_probe(struct platform_device *pdev)
 	int err;
 	u32 regval;
 
-	clk = clk_get(&pdev->dev, NULL);
+	clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
-		err = PTR_ERR(clk);
 		dev_err(&pdev->dev, "Clock get failed\n");
-		goto err_get_clk;
+		return PTR_ERR(clk);
 	}
 
 	err = clk_prepare(clk);
 	if (err) {
 		dev_err(&pdev->dev, "Clock prepare failed\n");
-		goto err_clk_prep;
+		return err;
 	}
 
 	err = clk_enable(clk);
@@ -387,9 +386,6 @@  out:
 	clk_disable(clk);
 err_clk_en:
 	clk_unprepare(clk);
-err_clk_prep:
-	clk_put(clk);
-err_get_clk:
 	return err;
 }
 
@@ -401,7 +397,6 @@  static int i2c_sirfsoc_remove(struct platform_device *pdev)
 	writel(SIRFSOC_I2C_RESET, siic->base + SIRFSOC_I2C_CTRL);
 	i2c_del_adapter(adapter);
 	clk_unprepare(siic->clk);
-	clk_put(siic->clk);
 	return 0;
 }