1 From cf1b789e1a6873d9680156fac9f675a0f1cdd17b Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 5 Feb 2015 16:01:44 +0000
4 Subject: [PATCH 107/114] i2c_bcm2708: Fix clock reference counting
7 drivers/i2c/busses/i2c-bcm2708.c | 12 ++++++++++--
8 1 file changed, 10 insertions(+), 2 deletions(-)
10 diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c
11 index 526129b..fda59ba 100644
12 --- a/drivers/i2c/busses/i2c-bcm2708.c
13 +++ b/drivers/i2c/busses/i2c-bcm2708.c
14 @@ -337,11 +337,17 @@ static int bcm2708_i2c_probe(struct platform_device *pdev)
18 + err = clk_prepare_enable(clk);
20 + dev_err(&pdev->dev, "could not enable clk: %d\n", err);
24 bcm2708_i2c_init_pinmode(pdev->id);
26 bi = kzalloc(sizeof(*bi), GFP_KERNEL);
29 + goto out_clk_disable;
31 platform_set_drvdata(pdev, bi);
33 @@ -412,6 +418,8 @@ out_iounmap:
38 + clk_disable_unprepare(clk);
42 @@ -426,7 +434,7 @@ static int bcm2708_i2c_remove(struct platform_device *pdev)
43 i2c_del_adapter(&bi->adapter);
44 free_irq(bi->irq, bi);
46 - clk_disable(bi->clk);
47 + clk_disable_unprepare(bi->clk);