clk: at91: Fix a return value in case of error
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 25 Sep 2016 11:53:58 +0000 (13:53 +0200)
committerStephen Boyd <sboyd@codeaurora.org>
Thu, 20 Oct 2016 23:37:56 +0000 (16:37 -0700)
If 'clk_hw_register()' fails, it is likely that we expect to return an
error instead of a valid pointer (which would mean success).

Fix commit f5644f10dcfb ("clk: at91: Migrate to clk_hw based registration
and OF APIs")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/at91/clk-programmable.c

index 190122e64a3a5e78079423c4f08f96a7ac52a1b2..85a449cf61e3fa79b36849f84a831e05683d48dc 100644 (file)
@@ -203,7 +203,7 @@ at91_clk_register_programmable(struct regmap *regmap,
        ret = clk_hw_register(NULL, &prog->hw);
        if (ret) {
                kfree(prog);
-               hw = &prog->hw;
+               hw = ERR_PTR(ret);
        }
 
        return hw;