summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorMasahiro Yamada2015-12-28 11:23:01 +0100
committerStephen Boyd2016-02-02 02:01:50 +0100
commit88cfbef2acd38443c3eed780263b5f5e95a8dc1f (patch)
tree4da2bbb704c306b49a6008f1c5f5846c13b0d8b7 /drivers/clk/clk.c
parentclk: move core->parents allocation to clk_register() (diff)
downloadkernel-qcow2-linux-88cfbef2acd38443c3eed780263b5f5e95a8dc1f.tar.gz
kernel-qcow2-linux-88cfbef2acd38443c3eed780263b5f5e95a8dc1f.tar.xz
kernel-qcow2-linux-88cfbef2acd38443c3eed780263b5f5e95a8dc1f.zip
clk: simplify clk_core_get_parent_by_index()
Drop the "if (!core->parents)" case and refactor the function a bit because core->parents is always allocated. (Strictly speaking, it is ZERO_SIZE_PTR if core->num_parents == 0, but such a case is omitted by the if-conditional above.) Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index a92feedda592..c2e993db0cfd 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -350,13 +350,12 @@ static struct clk_core *clk_core_get_parent_by_index(struct clk_core *core,
{
if (!core || index >= core->num_parents)
return NULL;
- else if (!core->parents)
- return clk_core_lookup(core->parent_names[index]);
- else if (!core->parents[index])
- return core->parents[index] =
- clk_core_lookup(core->parent_names[index]);
- else
- return core->parents[index];
+
+ if (!core->parents[index])
+ core->parents[index] =
+ clk_core_lookup(core->parent_names[index]);
+
+ return core->parents[index];
}
struct clk_hw *