diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-03-27 00:06:37 +0100 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-04-30 20:51:50 +0200 |
commit | 63589e92c2d975cc63222e5bd4a9a1fa2a1187ac (patch) | |
tree | c534ea7df24e67a08b94f86cf99e8ce437c7f9af /drivers/clk/clk.c | |
parent | clk: Consolidate recalc rate logic (diff) | |
download | linux-63589e92c2d975cc63222e5bd4a9a1fa2a1187ac.tar.xz linux-63589e92c2d975cc63222e5bd4a9a1fa2a1187ac.zip |
clk: Ignore error and NULL pointers passed to clk_{unprepare, disable}()
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>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r-- | drivers/clk/clk.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 3c02be74fd7c..4d562206d62f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -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); |