1
0
Fork 0
freescale-linux-fslc/drivers/clk/spear
Kees Cook fec61ff40b clk: spear: Remove uninitialized_var() usage
Using uninitialized_var() is dangerous as it papers over real bugs[1]
(or can in the future), and suppresses unrelated compiler warnings (e.g.
"unused variable"). If the compiler thinks it is uninitialized, either
simply initialize the variable or make compiler changes. As a precursor
to removing[2] this[3] macro[4], initialize "i" to zero. The compiler
warning was not a false positive, since clk_pll_set_rate()'s call to
clk_pll_round_rate_index() will always fail (since "prate" is NULL), so
"i" was never being initialized.

[1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
[2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
[3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
[4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

Fixes: 7d4998f71b ("clk: SPEAr: Vco-pll: Fix compilation warning")
Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
2020-07-16 12:32:26 -07:00
..
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
clk-aux-synth.c Merge branch 'clk-cleanup' into clk-next 2017-11-15 08:16:13 -08:00
clk-frac-synth.c clk: SPEAr: pr_err() strings should end with newlines 2017-12-06 22:39:57 -08:00
clk-gpt-synth.c SPEAr: clk: pr_err() strings should end with newlines 2017-12-06 22:39:59 -08:00
clk-vco-pll.c clk: spear: Remove uninitialized_var() usage 2020-07-16 12:32:26 -07:00
clk.c Update Viresh Kumar's email address 2015-07-17 16:39:53 -07:00
clk.h CLK: SPEAr: make structure field and function argument as const 2017-11-01 23:22:32 -07:00
spear3xx_clock.c clk: spear: Remove CLK_IS_ROOT 2016-03-02 17:46:55 -08:00
spear6xx_clock.c clk: spear: fix WDT clock definition on SPEAr600 2018-04-06 13:45:34 -07:00
spear1310_clock.c CLK: SPEAr: make aux_clk_masks structures const 2017-11-01 23:23:01 -07:00
spear1340_clock.c clk: spear: Make structure i2s_sclk_masks constant 2019-09-06 10:27:40 -07:00