Commit 508f884a authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Stephen Boyd

clk: make sure parent is not NULL in clk_fetch_parent_index()

If parent is given with NULL, clk_fetch_parent_index() could return
a positive index value.

Currently, parent is checked by the callers of this function, but
it would be safer to do it in this function.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarVladimir Zapolskiy <vz@mleia.com>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 0e8f6e49
......@@ -1066,6 +1066,9 @@ static int clk_fetch_parent_index(struct clk_core *core,
{
int i;
if (!parent)
return -EINVAL;
/*
* find index of new parent clock using cached parent ptrs,
* or if not yet cached, use string name comparison and cache
......
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