]> git.baikalelectronics.ru Git - kernel.git/commit
clk: bcm2835: Fix return type of bcm2835_register_gate
authorNathan Chancellor <natechancellor@gmail.com>
Sat, 16 May 2020 08:08:06 +0000 (01:08 -0700)
committerStephen Boyd <sboyd@kernel.org>
Tue, 26 May 2020 23:33:37 +0000 (16:33 -0700)
commit8f136dbf0d7be2641abb8e2f3d80e065cde961aa
treee65a7d980bd6235effe4446ccb2d0ea9d00a9e4b
parent0e6c92ce1d170795a396f8108369eb2c8412797f
clk: bcm2835: Fix return type of bcm2835_register_gate

bcm2835_register_gate is used as a callback for the clk_register member
of bcm2835_clk_desc, which expects a struct clk_hw * return type but
bcm2835_register_gate returns a struct clk *.

This discrepancy is hidden by the fact that bcm2835_register_gate is
cast to the typedef bcm2835_clk_register by the _REGISTER macro. This
turns out to be a control flow integrity violation, which is how this
was noticed.

Change the return type of bcm2835_register_gate to be struct clk_hw *
and use clk_hw_register_gate to do so. This should be a non-functional
change as clk_register_gate calls clk_hw_register_gate anyways but this
is needed to avoid issues with further changes.

Fixes: 39107ab73315 ("clk: bcm2835: Migrate to clk_hw based registration and OF APIs")
Link: https://github.com/ClangBuiltLinux/linux/issues/1028
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lkml.kernel.org/r/20200516080806.1459784-1-natechancellor@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/bcm/clk-bcm2835.c