diff options
author | Tomasz Figa <tomasz.figa@gmail.com> | 2013-09-28 20:37:16 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2013-10-01 21:40:17 -0400 |
commit | da0f0b2c3ad2ad9533c8c5cae84ad88d57a5e8dc (patch) | |
tree | 3243504931bfc96ef4ebf4963a9cdac45d27d9c0 /drivers/clk | |
parent | 96a7ed9079a3483c5681b17f4713c37c1cf2b1c9 (diff) |
clk: Correct lookup logic in clk_fetch_parent_index()
This function is supposed to iterate over all parents of given child
clock to find the index of given parent clock in its parent list,
using parent cache if possible and falling back to string compare
otherwise. However currently the logic falls back to string compare in
every iteration in which clock cache entry does not match given parent,
due to wrong check conditions.
This patch corrects the logic to continue the loop if parent cache entry
is present and does not match requested parent clock. In addition,
redundant checks for parent cache array presence are removed, because it
is always allocated in the beginning of the function.
Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 63f9ac16dcb6..32e2fed6d143 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1097,11 +1097,14 @@ static int clk_fetch_parent_index(struct clk *clk, struct clk *parent) | |||
1097 | * them now to avoid future calls to __clk_lookup. | 1097 | * them now to avoid future calls to __clk_lookup. |
1098 | */ | 1098 | */ |
1099 | for (i = 0; i < clk->num_parents; i++) { | 1099 | for (i = 0; i < clk->num_parents; i++) { |
1100 | if (clk->parents && clk->parents[i] == parent) | 1100 | if (clk->parents[i] == parent) |
1101 | return i; | 1101 | return i; |
1102 | else if (!strcmp(clk->parent_names[i], parent->name)) { | 1102 | |
1103 | if (clk->parents) | 1103 | if (clk->parents[i]) |
1104 | clk->parents[i] = __clk_lookup(parent->name); | 1104 | continue; |
1105 | |||
1106 | if (!strcmp(clk->parent_names[i], parent->name)) { | ||
1107 | clk->parents[i] = __clk_lookup(parent->name); | ||
1105 | return i; | 1108 | return i; |
1106 | } | 1109 | } |
1107 | } | 1110 | } |