]> git.karo-electronics.de Git - linux-beck.git/commitdiff
clk: Missing set_phase op is an error
authorStephen Boyd <sboyd@codeaurora.org>
Mon, 2 Feb 2015 22:09:43 +0000 (14:09 -0800)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 12 Mar 2015 19:18:49 +0000 (12:18 -0700)
If a clock's clk_ops doesn't have the set_phase op set we should
return an error from clk_set_phase(). This way clock consumers
know that when they tried to set a phase it didn't work, as
opposed to the current behavior where the return value is 0
meaning success.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/clk.c

index b0313cb4369cbc530cdc0a1ff93155101fcbaea6..0b3f39c037857ba9803d029bfdbde7ec1a0f2e84 100644 (file)
@@ -2123,10 +2123,10 @@ EXPORT_SYMBOL_GPL(clk_set_parent);
  */
 int clk_set_phase(struct clk *clk, int degrees)
 {
-       int ret = 0;
+       int ret = -EINVAL;
 
        if (!clk)
-               goto out;
+               return 0;
 
        /* sanity check degrees */
        degrees %= 360;
@@ -2135,18 +2135,14 @@ int clk_set_phase(struct clk *clk, int degrees)
 
        clk_prepare_lock();
 
-       if (!clk->core->ops->set_phase)
-               goto out_unlock;
-
-       ret = clk->core->ops->set_phase(clk->core->hw, degrees);
+       if (clk->core->ops->set_phase)
+               ret = clk->core->ops->set_phase(clk->core->hw, degrees);
 
        if (!ret)
                clk->core->phase = degrees;
 
-out_unlock:
        clk_prepare_unlock();
 
-out:
        return ret;
 }
 EXPORT_SYMBOL_GPL(clk_set_phase);