mxc: vpu: improve clk enable/disable handling
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 26 Feb 2015 10:00:40 +0000 (11:00 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 26 Feb 2015 10:00:40 +0000 (11:00 +0100)
drivers/mxc/vpu/mxc_vpu.c

index f0ea06e..44048d1 100644 (file)
@@ -138,20 +138,18 @@ static struct regulator *vpu_regulator;
 
 static int vpu_clk_enable(struct vpu_priv *vpu_data)
 {
-       int ret = 0;
+       if (WARN_ON(vpu_data->clk_enabled < 0))
+               return -EINVAL;
 
        if (vpu_data->clk_enabled++ == 0)
-               ret = clk_prepare_enable(vpu_clk);
-
-       if (WARN_ON(vpu_data->clk_enabled <= 0))
-               return -EINVAL;
+               return clk_prepare_enable(vpu_clk);
 
-       return ret;
+       return 0;
 }
 
 static int vpu_clk_disable(struct vpu_priv *vpu_data)
 {
-       if (WARN_ON(vpu_data->clk_enabled == 0))
+       if (WARN_ON(vpu_data->clk_enabled <= 0))
                return -EINVAL;
 
        if (--vpu_data->clk_enabled == 0)