diff options
author | Arnd Bergmann <arnd@arndb.de> | 2017-04-19 13:44:55 -0400 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2017-04-28 14:07:09 -0400 |
commit | 3417f3528a2c7f8824cad7f0c35425961e98886b (patch) | |
tree | 4a4a1775d9ff11a1e6d8caaad7a60f14adc507d6 | |
parent | ee7d74339df71015ae5b98d91393ea80b72a4546 (diff) |
clk: ti: divider: try to fix ti_clk_register_divider
Commit 6c0afb503937 ("clk: ti: convert to use proper register
definition for all accesses") converted all register accesses in
the TI clk driver to use a proper struct instead of a void
pointer casted struct that fits into a u32. Unfortunately, it
missed a conversion here in the didivder code, leading to a
compiler warning like so:
drivers/clk/ti/divider.c: In function 'ti_clk_register_divider':
drivers/clk/ti/divider.c:460:8: error: 'reg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
Treating a 'u32' variable as a structure leads to a stack
overflow here, and the register address we pass down is never
initialized. Convert this part of the code as well so things
work properly.
Fixes: 6c0afb503937 ("clk: ti: convert to use proper register definition for all accesses")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[sboyd@codeaurora.org: Fixed fixes tag, rewrote commit message,
s/reg_setup/reg/]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r-- | drivers/clk/ti/divider.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index d6dcb283b72b..88f04a4cb890 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
@@ -428,22 +428,17 @@ struct clk_hw *ti_clk_build_component_div(struct ti_clk_divider *setup) | |||
428 | 428 | ||
429 | struct clk *ti_clk_register_divider(struct ti_clk *setup) | 429 | struct clk *ti_clk_register_divider(struct ti_clk *setup) |
430 | { | 430 | { |
431 | struct ti_clk_divider *div; | 431 | struct ti_clk_divider *div = setup->data; |
432 | struct clk_omap_reg *reg_setup; | 432 | struct clk_omap_reg reg = { |
433 | u32 reg; | 433 | .index = div->module, |
434 | .offset = div->reg, | ||
435 | }; | ||
434 | u8 width; | 436 | u8 width; |
435 | u32 flags = 0; | 437 | u32 flags = 0; |
436 | u8 div_flags = 0; | 438 | u8 div_flags = 0; |
437 | const struct clk_div_table *table; | 439 | const struct clk_div_table *table; |
438 | struct clk *clk; | 440 | struct clk *clk; |
439 | 441 | ||
440 | div = setup->data; | ||
441 | |||
442 | reg_setup = (struct clk_omap_reg *)® | ||
443 | |||
444 | reg_setup->index = div->module; | ||
445 | reg_setup->offset = div->reg; | ||
446 | |||
447 | if (div->flags & CLKF_INDEX_STARTS_AT_ONE) | 442 | if (div->flags & CLKF_INDEX_STARTS_AT_ONE) |
448 | div_flags |= CLK_DIVIDER_ONE_BASED; | 443 | div_flags |= CLK_DIVIDER_ONE_BASED; |
449 | 444 | ||
@@ -458,7 +453,7 @@ struct clk *ti_clk_register_divider(struct ti_clk *setup) | |||
458 | return (struct clk *)table; | 453 | return (struct clk *)table; |
459 | 454 | ||
460 | clk = _register_divider(NULL, setup->name, div->parent, | 455 | clk = _register_divider(NULL, setup->name, div->parent, |
461 | flags, (void __iomem *)reg, div->bit_shift, | 456 | flags, ®, div->bit_shift, |
462 | width, div_flags, table); | 457 | width, div_flags, table); |
463 | 458 | ||
464 | if (IS_ERR(clk)) | 459 | if (IS_ERR(clk)) |