clk-gate: fix bit # check in clk_register_gate()
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Wed, 24 Dec 2014 14:43:27 +0000 (17:43 +0300)
committerMichael Turquette <mturquette@linaro.org>
Tue, 20 Jan 2015 18:09:05 +0000 (10:09 -0800)
In case CLK_GATE_HIWORD_MASK flag is passed to clk_register_gate(), the bit #
should be no higher than 15, however the corresponding check is obviously off-
by-one.

Fixes: 045779942c04 ("clk: gate: add CLK_GATE_HIWORD_MASK")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Michael Turquette <mturquette@linaro.org>
drivers/clk/clk-gate.c

index 186b96efeebffb5c85bd1d273dc6f1a3e0a7bccb..3f0e4200cb5d4ca4a680c78479ac86ed116766a5 100644 (file)
@@ -128,7 +128,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
        struct clk_init_data init;
 
        if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
-               if (bit_idx > 16) {
+               if (bit_idx > 15) {
                        pr_err("gate bit exceeds LOWORD field\n");
                        return ERR_PTR(-EINVAL);
                }