clk: slightly optimize clk_core_set_parent()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 28 Dec 2015 10:23:10 +0000 (19:23 +0900)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 2 Feb 2016 19:53:17 +0000 (11:53 -0800)
If clk_fetch_parent_index() fails, p_rate is unused.  Move the
assignment after the error checking.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c

index 82b79a6ec0ec2beef64b16d9b8f3e7af1d09af3a..d31ed95d27a46d1f25a49d63b07a64d181aa0201 100644 (file)
@@ -1748,13 +1748,13 @@ static int clk_core_set_parent(struct clk_core *core, struct clk_core *parent)
        /* try finding the new parent index */
        if (parent) {
                p_index = clk_fetch_parent_index(core, parent);
-               p_rate = parent->rate;
                if (p_index < 0) {
                        pr_debug("%s: clk %s can not be parent of clk %s\n",
                                        __func__, parent->name, core->name);
                        ret = p_index;
                        goto out;
                }
+               p_rate = parent->rate;
        }
 
        /* propagate PRE_RATE_CHANGE notifications */