Commit 63589e92 authored by Stephen Boyd's avatar Stephen Boyd Committed by Mike Turquette

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: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
parent 8f2c2db1
...@@ -822,6 +822,9 @@ void __clk_unprepare(struct clk *clk) ...@@ -822,6 +822,9 @@ void __clk_unprepare(struct clk *clk)
*/ */
void clk_unprepare(struct clk *clk) void clk_unprepare(struct clk *clk)
{ {
if (IS_ERR_OR_NULL(clk))
return;
clk_prepare_lock(); clk_prepare_lock();
__clk_unprepare(clk); __clk_unprepare(clk);
clk_prepare_unlock(); clk_prepare_unlock();
...@@ -883,9 +886,6 @@ static void __clk_disable(struct clk *clk) ...@@ -883,9 +886,6 @@ static void __clk_disable(struct clk *clk)
if (!clk) if (!clk)
return; return;
if (WARN_ON(IS_ERR(clk)))
return;
if (WARN_ON(clk->enable_count == 0)) if (WARN_ON(clk->enable_count == 0))
return; return;
...@@ -914,6 +914,9 @@ void clk_disable(struct clk *clk) ...@@ -914,6 +914,9 @@ void clk_disable(struct clk *clk)
{ {
unsigned long flags; unsigned long flags;
if (IS_ERR_OR_NULL(clk))
return;
flags = clk_enable_lock(); flags = clk_enable_lock();
__clk_disable(clk); __clk_disable(clk);
clk_enable_unlock(flags); clk_enable_unlock(flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment