Commit 84b02b20 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Luis Henriques

clk: st: avoid uninitialized variable use

commit 2dd52d7f upstream.

quadfs_pll_fs660c32_round_rate prints a few structure members
that are never initialized, and also doesn't print the only one
it cares about. We get a gcc warning about the ones that
are printed:

clk/st/clkgen-fsyn.c:560:93: warning: 'params.sdiv' may be used uninitialized in this function
clk/st/clkgen-fsyn.c:560:93: warning: 'params.mdiv' may be used uninitialized in this function
clk/st/clkgen-fsyn.c:560:93: warning: 'params.pe' may be used uninitialized in this function
clk/st/clkgen-fsyn.c:560:93: warning: 'params.nsdiv' may be used uninitialized in this function

This changes the code to no longer print uninitialized data, and
for good measure it also prints the ndiv member that is being
set.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Fixes: 5f7aa907 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
Acked-by: default avatarGabriel Fernandez <gabriel.fernandez@linaro.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent ba65b79d
...@@ -408,19 +408,20 @@ int clk_fs660c32_vco_get_params(unsigned long input, ...@@ -408,19 +408,20 @@ int clk_fs660c32_vco_get_params(unsigned long input,
return 0; return 0;
} }
static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
, unsigned long *prate) unsigned long rate,
unsigned long *prate)
{ {
struct stm_fs params; struct stm_fs params;
if (!clk_fs660c32_vco_get_params(*prate, rate, &params)) if (clk_fs660c32_vco_get_params(*prate, rate, &params))
return rate;
clk_fs660c32_vco_get_rate(*prate, &params, &rate); clk_fs660c32_vco_get_rate(*prate, &params, &rate);
pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n", pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
__func__, __clk_get_name(hw->clk), __func__, __clk_get_name(hw->clk),
rate, (unsigned int)params.sdiv, rate, (unsigned int)params.ndiv);
(unsigned int)params.mdiv,
(unsigned int)params.pe, (unsigned int)params.nsdiv);
return rate; return rate;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment