]> git.karo-electronics.de Git - linux-beck.git/commitdiff
clk: Ignore error and NULL pointers passed to clk_{unprepare, disable}()
authorStephen Boyd <sboyd@codeaurora.org>
Wed, 26 Mar 2014 23:06:37 +0000 (16:06 -0700)
committerMike Turquette <mturquette@linaro.org>
Wed, 30 Apr 2014 18:51:50 +0000 (11:51 -0700)
This simplifies error paths in drivers that use optional clocks
by allowing the NULL or error pointer to be passed
unconditionally.

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

index 3c02be74fd7c250fcd859edb2fe2a46cfd0de887..4d562206d62f193ae9b4036505d067c2638c8127 100644 (file)
@@ -822,6 +822,9 @@ void __clk_unprepare(struct clk *clk)
  */
 void clk_unprepare(struct clk *clk)
 {
+       if (IS_ERR_OR_NULL(clk))
+               return;
+
        clk_prepare_lock();
        __clk_unprepare(clk);
        clk_prepare_unlock();
@@ -883,9 +886,6 @@ static void __clk_disable(struct clk *clk)
        if (!clk)
                return;
 
-       if (WARN_ON(IS_ERR(clk)))
-               return;
-
        if (WARN_ON(clk->enable_count == 0))
                return;
 
@@ -914,6 +914,9 @@ void clk_disable(struct clk *clk)
 {
        unsigned long flags;
 
+       if (IS_ERR_OR_NULL(clk))
+               return;
+
        flags = clk_enable_lock();
        __clk_disable(clk);
        clk_enable_unlock(flags);