linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: chelsio: cxgb4: t4_hw.c:  Cleaning up uninitialized variables
@ 2014-06-01 12:34 Rickard Strandqvist
  2014-06-01 19:11 ` Dimitrios Michailidis
  0 siblings, 1 reply; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 12:34 UTC (permalink / raw)
  To: Dimitris Michailidis, netdev; +Cc: Rickard Strandqvist, linux-kernel

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
index bba6768..326c005 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
@@ -571,7 +571,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool enable)
  */
 int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
 {
-	u32 cclk_param, cclk_val;
+	u32 cclk_param, cclk_val = 0;
 	int i, ret, addr;
 	int ec, sn, pn;
 	u8 *vpd, csum;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] net: ethernet: chelsio: cxgb4: t4_hw.c:  Cleaning up uninitialized variables
  2014-06-01 12:34 [PATCH] net: ethernet: chelsio: cxgb4: t4_hw.c: Cleaning up uninitialized variables Rickard Strandqvist
@ 2014-06-01 19:11 ` Dimitrios Michailidis
  2014-06-01 19:36   ` Rickard Strandqvist
  0 siblings, 1 reply; 3+ messages in thread
From: Dimitrios Michailidis @ 2014-06-01 19:11 UTC (permalink / raw)
  To: Rickard Strandqvist, netdev; +Cc: linux-kernel

Rickard Strandqvist wrote:
> There is a risk that the variable will be used without being initialized.

There isn't actual risk here, this variable is not used uninitialized AFAICS.

> This was largely found by using a static code analysis program called cppcheck.

It seems this is a false inference by the tool.  I think the preferred method to suppress false tool warnings is to use uninitialized_var.
 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> index bba6768..326c005 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
> @@ -571,7 +571,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool
> enable)
>   */
>  int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
>  {
> -	u32 cclk_param, cclk_val;
> +	u32 cclk_param, cclk_val = 0;
>  	int i, ret, addr;
>  	int ec, sn, pn;
>  	u8 *vpd, csum;
> --
> 1.7.10.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet: chelsio: cxgb4: t4_hw.c: Cleaning up uninitialized variables
  2014-06-01 19:11 ` Dimitrios Michailidis
@ 2014-06-01 19:36   ` Rickard Strandqvist
  0 siblings, 0 replies; 3+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 19:36 UTC (permalink / raw)
  To: Dimitrios Michailidis; +Cc: netdev, linux-kernel

Hi Dimitrios!

Okay sorry, I see what you mean...

Best regards
Rickard Strandqvist


2014-06-01 21:11 GMT+02:00 Dimitrios Michailidis <dm@chelsio.com>:
> Rickard Strandqvist wrote:
>> There is a risk that the variable will be used without being initialized.
>
> There isn't actual risk here, this variable is not used uninitialized AFAICS.
>
>> This was largely found by using a static code analysis program called cppcheck.
>
> It seems this is a false inference by the tool.  I think the preferred method to suppress false tool warnings is to use uninitialized_var.
>
>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> ---
>>  drivers/net/ethernet/chelsio/cxgb4/t4_hw.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> index bba6768..326c005 100644
>> --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
>> @@ -571,7 +571,7 @@ int t4_seeprom_wp(struct adapter *adapter, bool
>> enable)
>>   */
>>  int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
>>  {
>> -     u32 cclk_param, cclk_val;
>> +     u32 cclk_param, cclk_val = 0;
>>       int i, ret, addr;
>>       int ec, sn, pn;
>>       u8 *vpd, csum;
>> --
>> 1.7.10.4
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-01 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 12:34 [PATCH] net: ethernet: chelsio: cxgb4: t4_hw.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-01 19:11 ` Dimitrios Michailidis
2014-06-01 19:36   ` Rickard Strandqvist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).