Merge branch 'clk-fixes' into clk-next
[cascardo/linux.git] / drivers / clk / clk.c
index 43e2c3a..b005f66 100644 (file)
@@ -1685,7 +1685,7 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
                        "%s: multi-parent clocks must implement .get_parent\n",
                        __func__);
                goto out;
-       };
+       }
 
        /*
         * Do our best to cache parent clocks in core->parents.  This prevents
@@ -2437,7 +2437,8 @@ static int __clk_init(struct device *dev, struct clk *clk_user)
        hlist_for_each_entry_safe(orphan, tmp2, &clk_orphan_list, child_node) {
                if (orphan->num_parents && orphan->ops->get_parent) {
                        i = orphan->ops->get_parent(orphan->hw);
-                       if (!strcmp(core->name, orphan->parent_names[i]))
+                       if (i >= 0 && i < orphan->num_parents &&
+                           !strcmp(core->name, orphan->parent_names[i]))
                                clk_core_reparent(orphan, core);
                        continue;
                }