clk: clk_set_parent() with current parent shouldn't fail
[sfrench/cifs-2.6.git] / drivers / clk / clk.c
index 42064cec236409b1e4af817d2d6de22287438a89..3e10cdff284b8522a80ab436e8795cd0233fd855 100644 (file)
@@ -2055,16 +2055,18 @@ static int clk_core_set_parent(struct clk_core *clk, struct clk_core *parent)
        if (!clk)
                return 0;
 
-       /* verify ops for for multi-parent clks */
-       if ((clk->num_parents > 1) && (!clk->ops->set_parent))
-               return -ENOSYS;
-
        /* prevent racing with updates to the clock topology */
        clk_prepare_lock();
 
        if (clk->parent == parent)
                goto out;
 
+       /* verify ops for for multi-parent clks */
+       if ((clk->num_parents > 1) && (!clk->ops->set_parent)) {
+               ret = -ENOSYS;
+               goto out;
+       }
+
        /* check that we are allowed to re-parent if the clock is in use */
        if ((clk->flags & CLK_SET_PARENT_GATE) && clk->prepare_count) {
                ret = -EBUSY;