]> git.baikalelectronics.ru Git - kernel.git/commit
clk: rockchip: Initialize hw to error to avoid undefined behavior
authorStephen Boyd <sboyd@kernel.org>
Thu, 24 Sep 2020 00:41:44 +0000 (17:41 -0700)
committerStephen Boyd <sboyd@kernel.org>
Thu, 8 Oct 2020 02:08:38 +0000 (19:08 -0700)
commitd2045a32e4703be3d65c053f6813f06aa4d0cad0
treecf50589379935c8d5c5bf26935297e8101e342eb
parentc717c9a9410e1dbd070ac63d60b176122476a3a2
clk: rockchip: Initialize hw to error to avoid undefined behavior

We can get down to this return value from ERR_CAST() without
initializing hw. Set it to -ENOMEM so that we always return something
sane.

Fixes the following smatch warning:

drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() error: uninitialized symbol 'hw'.
drivers/clk/rockchip/clk-half-divider.c:228 rockchip_clk_register_halfdiv() warn: passing zero to 'ERR_CAST'

Cc: Elaine Zhang <zhangqing@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Fixes: 5db65f8edbe7 ("clk: rockchip: add support for half divider")
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/rockchip/clk-half-divider.c