Message ID | 1451297429-21689-15-git-send-email-yamada.masahiro@socionext.com |
---|---|
State | Not Applicable |
Headers | show |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index efd093a..151cbe8 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -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
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: Masahiro Yamada <yamada.masahiro@socionext.com> --- Changes in v2: - Fix a bug. Return -EINVAL when parent _is_ NULL. drivers/clk/clk.c | 3 +++ 1 file changed, 3 insertions(+)