audio: a2220: disable and release clk when probe failed
Eric Miao [Fri, 19 Apr 2013 05:26:28 +0000 (13:26 +0800)]
bug 1271568

Change-Id: I49af42385ffced98b358861850bf88d739cb2dcd
Signed-off-by: Eric Miao <emiao@nvidia.com>
Reviewed-on: http://git-master/r/220895
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Vijay Mali <vmali@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/misc/a2220.c

index 7eacbe6..6789fa6 100644 (file)
@@ -1117,13 +1117,13 @@ static int a2220_probe(struct i2c_client *client,
        extern3_clk = clk_get_sys("extern3", NULL);
        if (IS_ERR(extern3_clk)) {
                printk(KERN_ERR "%s: Can't retrieve extern3\n", __func__);
-               goto err_alloc_data_failed;
+               goto err_clk_get_failed;
        }
 
        ret = clk_enable(extern3_clk);
        if (ret) {
                printk(KERN_ERR "Can't enable clk extern3");
-               goto err_alloc_data_failed;
+               goto err_clk_enable_failed;
        }
 
        control_a2220_clk = 1;
@@ -1378,6 +1378,10 @@ static int a2220_probe(struct i2c_client *client,
        if (pdata->gpio_a2220_clk)
                gpio_free(pdata->gpio_a2220_clk);
  err_alloc_data_failed:
+       clk_disable(extern3_clk);
+ err_clk_enable_failed:
+       clk_put(extern3_clk);
+ err_clk_get_failed:
 
        return rc;
 }