* [PATCH] clk: st: avoid uninitialized variable use
@ 2015-11-12 14:24 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2015-11-12 14:24 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Gabriel Fernandez, Pankaj Dev, linux-clk, linux-kernel,
linux-arm-kernel, kernel, Maxime Coquelin, Srinivas Kandagatla,
Patrice Chotard
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: Arnd Bergmann <arnd@arndb.de>
Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index 576cd0354d48..ccb324d97160 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input,
return 0;
}
-static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate
- , unsigned long *prate)
+static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
+ unsigned long rate,
+ unsigned long *prate)
{
struct stm_fs params;
- if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
- clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
+ if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
+ return rate;
- pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n",
+ clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
+
+ pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
__func__, clk_hw_get_name(hw),
- rate, (unsigned int)params.sdiv,
- (unsigned int)params.mdiv,
- (unsigned int)params.pe, (unsigned int)params.nsdiv);
+ rate, (unsigned int)params.ndiv);
return rate;
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2015-11-12 14:24 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2015-11-12 14:24 UTC (permalink / raw)
To: linux-arm-kernel
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: Arnd Bergmann <arnd@arndb.de>
Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index 576cd0354d48..ccb324d97160 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input,
return 0;
}
-static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate
- , unsigned long *prate)
+static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
+ unsigned long rate,
+ unsigned long *prate)
{
struct stm_fs params;
- if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
- clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
+ if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
+ return rate;
- pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n",
+ clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
+
+ pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
__func__, clk_hw_get_name(hw),
- rate, (unsigned int)params.sdiv,
- (unsigned int)params.mdiv,
- (unsigned int)params.pe, (unsigned int)params.nsdiv);
+ rate, (unsigned int)params.ndiv);
return rate;
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] clk: st: avoid uninitialized variable use
2015-11-12 14:24 ` Arnd Bergmann
(?)
@ 2015-11-16 8:27 ` Gabriel Fernandez
-1 siblings, 0 replies; 11+ messages in thread
From: Gabriel Fernandez @ 2015-11-16 8:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michael Turquette, Stephen Boyd, kernel, Srinivas Kandagatla,
linux-kernel, Patrice Chotard, Pankaj Dev, linux-clk,
linux-arm-kernel, Maxime Coquelin
On 12 November 2015 at 15:24, Arnd Bergmann <arnd@arndb.de> wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
>
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 576cd0354d48..ccb324d97160 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input,
> return 0;
> }
>
> -static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate
> - , unsigned long *prate)
> +static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
> + unsigned long rate,
> + unsigned long *prate)
> {
> struct stm_fs params;
>
> - if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> - clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> + if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> + return rate;
>
> - pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n",
> + clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> +
> + pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
> __func__, clk_hw_get_name(hw),
> - rate, (unsigned int)params.sdiv,
> - (unsigned int)params.mdiv,
> - (unsigned int)params.pe, (unsigned int)params.nsdiv);
> + rate, (unsigned int)params.ndiv);
>
> return rate;
> }
>
>
Acked-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] clk: st: avoid uninitialized variable use
@ 2015-11-16 8:27 ` Gabriel Fernandez
0 siblings, 0 replies; 11+ messages in thread
From: Gabriel Fernandez @ 2015-11-16 8:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michael Turquette, Stephen Boyd, kernel, Srinivas Kandagatla,
linux-kernel, Patrice Chotard, Pankaj Dev, linux-clk,
linux-arm-kernel, Maxime Coquelin
On 12 November 2015 at 15:24, Arnd Bergmann <arnd@arndb.de> wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
>
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 576cd0354d48..ccb324d97160 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input,
> return 0;
> }
>
> -static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate
> - , unsigned long *prate)
> +static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
> + unsigned long rate,
> + unsigned long *prate)
> {
> struct stm_fs params;
>
> - if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> - clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> + if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> + return rate;
>
> - pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n",
> + clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> +
> + pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
> __func__, clk_hw_get_name(hw),
> - rate, (unsigned int)params.sdiv,
> - (unsigned int)params.mdiv,
> - (unsigned int)params.pe, (unsigned int)params.nsdiv);
> + rate, (unsigned int)params.ndiv);
>
> return rate;
> }
>
>
Acked-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2015-11-16 8:27 ` Gabriel Fernandez
0 siblings, 0 replies; 11+ messages in thread
From: Gabriel Fernandez @ 2015-11-16 8:27 UTC (permalink / raw)
To: linux-arm-kernel
On 12 November 2015 at 15:24, Arnd Bergmann <arnd@arndb.de> wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
>
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 576cd0354d48..ccb324d97160 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -549,19 +549,20 @@ static int clk_fs660c32_vco_get_params(unsigned long input,
> return 0;
> }
>
> -static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw, unsigned long rate
> - , unsigned long *prate)
> +static long quadfs_pll_fs660c32_round_rate(struct clk_hw *hw,
> + unsigned long rate,
> + unsigned long *prate)
> {
> struct stm_fs params;
>
> - if (!clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> - clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> + if (clk_fs660c32_vco_get_params(*prate, rate, ¶ms))
> + return rate;
>
> - pr_debug("%s: %s new rate %ld [sdiv=0x%x,md=0x%x,pe=0x%x,nsdiv3=%u]\n",
> + clk_fs660c32_vco_get_rate(*prate, ¶ms, &rate);
> +
> + pr_debug("%s: %s new rate %ld [ndiv=%u]\n",
> __func__, clk_hw_get_name(hw),
> - rate, (unsigned int)params.sdiv,
> - (unsigned int)params.mdiv,
> - (unsigned int)params.pe, (unsigned int)params.nsdiv);
> + rate, (unsigned int)params.ndiv);
>
> return rate;
> }
>
>
Acked-by: Gabriel Fernandez <gabriel.fernandez@linaro.org>
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] clk: st: avoid uninitialized variable use
2015-11-12 14:24 ` Arnd Bergmann
@ 2015-11-20 18:59 ` Stephen Boyd
-1 siblings, 0 replies; 11+ messages in thread
From: Stephen Boyd @ 2015-11-20 18:59 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michael Turquette, Gabriel Fernandez, Pankaj Dev, linux-clk,
linux-kernel, linux-arm-kernel, kernel, Maxime Coquelin,
Srinivas Kandagatla, Patrice Chotard
On 11/12, Arnd Bergmann wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
>
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 576cd0354d48..ccb324d97160 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2015-11-20 18:59 ` Stephen Boyd
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Boyd @ 2015-11-20 18:59 UTC (permalink / raw)
To: linux-arm-kernel
On 11/12, Arnd Bergmann wrote:
> 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: Arnd Bergmann <arnd@arndb.de>
> Fixes: 5f7aa9071e93 ("clk: st: Support for QUADFS inside ClockGenB/C/D/E/F")
>
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 576cd0354d48..ccb324d97160 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] clk: st: avoid uninitialized variable use
2016-01-25 15:54 ` Arnd Bergmann
@ 2016-01-30 1:20 ` Stephen Boyd
-1 siblings, 0 replies; 11+ messages in thread
From: Stephen Boyd @ 2016-01-30 1:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Michael Turquette, linux-arm-kernel, Gabriel Fernandez,
Pankaj Dev, linux-clk, linux-kernel
On 01/25, Arnd Bergmann wrote:
> My previous patch fixed some warnings about printing a couple
> of variables that are always uninitialized in quadfs_pll_fs660c32_set_rate(),
> but I now got a warning that only shows up in some configurations (i.e.
> without gcc -Os) about the params.ndiv being used uninitialized in the
> error case:
>
> drivers/clk/st/clkgen-fsyn.c: In function 'quadfs_pll_fs660c32_set_rate':
> drivers/clk/st/clkgen-fsyn.c:584:75: warning: 'params.ndiv' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/clk/st/clkgen-fsyn.c:574:16: note: 'params.ndiv' was declared here
>
> This changes the error handling so we bail for invalid arguments rather
> than continuing with uninitialized data.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2016-01-30 1:20 ` Stephen Boyd
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Boyd @ 2016-01-30 1:20 UTC (permalink / raw)
To: linux-arm-kernel
On 01/25, Arnd Bergmann wrote:
> My previous patch fixed some warnings about printing a couple
> of variables that are always uninitialized in quadfs_pll_fs660c32_set_rate(),
> but I now got a warning that only shows up in some configurations (i.e.
> without gcc -Os) about the params.ndiv being used uninitialized in the
> error case:
>
> drivers/clk/st/clkgen-fsyn.c: In function 'quadfs_pll_fs660c32_set_rate':
> drivers/clk/st/clkgen-fsyn.c:584:75: warning: 'params.ndiv' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/clk/st/clkgen-fsyn.c:574:16: note: 'params.ndiv' was declared here
>
> This changes the error handling so we bail for invalid arguments rather
> than continuing with uninitialized data.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2016-01-25 15:54 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2016-01-25 15:54 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-arm-kernel, Arnd Bergmann, Gabriel Fernandez, Pankaj Dev,
linux-clk, linux-kernel
My previous patch fixed some warnings about printing a couple
of variables that are always uninitialized in quadfs_pll_fs660c32_set_rate(),
but I now got a warning that only shows up in some configurations (i.e.
without gcc -Os) about the params.ndiv being used uninitialized in the
error case:
drivers/clk/st/clkgen-fsyn.c: In function 'quadfs_pll_fs660c32_set_rate':
drivers/clk/st/clkgen-fsyn.c:584:75: warning: 'params.ndiv' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/clk/st/clkgen-fsyn.c:574:16: note: 'params.ndiv' was declared here
This changes the error handling so we bail for invalid arguments rather
than continuing with uninitialized data.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/clk/st/clkgen-fsyn.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index ccb324d97160..dec4eaaecc00 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -574,12 +574,16 @@ static int quadfs_pll_fs660c32_set_rate(struct clk_hw *hw, unsigned long rate,
struct stm_fs params;
long hwrate = 0;
unsigned long flags = 0;
+ int ret;
if (!rate || !parent_rate)
return -EINVAL;
- if (!clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms))
- clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate);
+ ret = clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms);
+ if (ret)
+ return ret;
+
+ clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate);
pr_debug("%s: %s new rate %ld [ndiv=0x%x]\n",
__func__, clk_hw_get_name(hw),
--
2.7.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] clk: st: avoid uninitialized variable use
@ 2016-01-25 15:54 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2016-01-25 15:54 UTC (permalink / raw)
To: linux-arm-kernel
My previous patch fixed some warnings about printing a couple
of variables that are always uninitialized in quadfs_pll_fs660c32_set_rate(),
but I now got a warning that only shows up in some configurations (i.e.
without gcc -Os) about the params.ndiv being used uninitialized in the
error case:
drivers/clk/st/clkgen-fsyn.c: In function 'quadfs_pll_fs660c32_set_rate':
drivers/clk/st/clkgen-fsyn.c:584:75: warning: 'params.ndiv' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/clk/st/clkgen-fsyn.c:574:16: note: 'params.ndiv' was declared here
This changes the error handling so we bail for invalid arguments rather
than continuing with uninitialized data.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/clk/st/clkgen-fsyn.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index ccb324d97160..dec4eaaecc00 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -574,12 +574,16 @@ static int quadfs_pll_fs660c32_set_rate(struct clk_hw *hw, unsigned long rate,
struct stm_fs params;
long hwrate = 0;
unsigned long flags = 0;
+ int ret;
if (!rate || !parent_rate)
return -EINVAL;
- if (!clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms))
- clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate);
+ ret = clk_fs660c32_vco_get_params(parent_rate, rate, ¶ms);
+ if (ret)
+ return ret;
+
+ clk_fs660c32_vco_get_rate(parent_rate, ¶ms, &hwrate);
pr_debug("%s: %s new rate %ld [ndiv=0x%x]\n",
__func__, clk_hw_get_name(hw),
--
2.7.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-01-30 1:20 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 14:24 [PATCH] clk: st: avoid uninitialized variable use Arnd Bergmann
2015-11-12 14:24 ` Arnd Bergmann
2015-11-16 8:27 ` Gabriel Fernandez
2015-11-16 8:27 ` Gabriel Fernandez
2015-11-16 8:27 ` Gabriel Fernandez
2015-11-20 18:59 ` Stephen Boyd
2015-11-20 18:59 ` Stephen Boyd
2016-01-25 15:54 Arnd Bergmann
2016-01-25 15:54 ` Arnd Bergmann
2016-01-30 1:20 ` Stephen Boyd
2016-01-30 1:20 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.