Skip to content

Commit 05cd693

Browse files
arndbgregkh
authored andcommitted
clk: sunxi: fix uninitialized access
commit 4e90345 upstream. gcc-8 reports an uninitialized variable access in a code path that we would see with incorrect DTB input: drivers/clk/sunxi/clk-sun8i-bus-gates.c: In function 'sun8i_h3_bus_gates_init': drivers/clk/sunxi/clk-sun8i-bus-gates.c:85:27: error: 'clk_parent' may be used uninitialized in this function [-Werror=maybe-uninitialized] This works around by skipping invalid input and printing a warning instead if it ever happens. The problem was apparently part of the initiali driver submission, but older compilers don't notice it. Fixes: ab6e23a ("clk: sunxi: Add H3 clocks support") Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Maxime Ripard <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bd67557 commit 05cd693

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/clk/sunxi/clk-sun8i-bus-gates.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node)
7878
clk_parent = APB1;
7979
else if (index >= 96 && index <= 127)
8080
clk_parent = APB2;
81+
else {
82+
WARN_ON(true);
83+
continue;
84+
}
8185

8286
clk_reg = reg + 4 * (index / 32);
8387
clk_bit = index % 32;

0 commit comments

Comments
 (0)