Commit 89ac8d7a authored by Mike Turquette's avatar Mike Turquette

clk: handle NULL struct clk gracefully

At some point changes to clk_set_rate and clk_set_parent introduced a
bug whereby NULL struct clk pointers were treated as an error. This is
in violation of the API in include/linux/clk.h. Reintroduce graceful
handling of NULL clk's by bailing from clk_set_rate and clk_set_parent
with return codes of zero.
Signed-off-by: default avatarMike Turquette <mturquette@linaro.org>
parent bddbd134
...@@ -1428,6 +1428,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate) ...@@ -1428,6 +1428,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
struct clk *top, *fail_clk; struct clk *top, *fail_clk;
int ret = 0; int ret = 0;
if (!clk)
return 0;
/* prevent racing with updates to the clock topology */ /* prevent racing with updates to the clock topology */
clk_prepare_lock(); clk_prepare_lock();
...@@ -1567,7 +1570,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent) ...@@ -1567,7 +1570,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
u8 p_index = 0; u8 p_index = 0;
unsigned long p_rate = 0; unsigned long p_rate = 0;
if (!clk || !clk->ops) if (!clk)
return 0;
if (!clk->ops)
return -EINVAL; return -EINVAL;
/* verify ops for for multi-parent clks */ /* verify ops for for multi-parent clks */
......
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