netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] atm: fore200e.c:  Cleaning up uninitialized variables
@ 2014-05-31 23:08 Rickard Strandqvist
  2014-06-02  0:10 ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Rickard Strandqvist @ 2014-05-31 23:08 UTC (permalink / raw)
  To: Chas Williams, Grant Likely
  Cc: Rickard Strandqvist, Rob Herring, linux-atm-general, netdev,
	linux-kernel, devicetree

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/atm/fore200e.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index 204814e..d4725fc 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -2780,7 +2780,7 @@ static struct pci_driver fore200e_pca_driver = {
 
 static int __init fore200e_module_init(void)
 {
-	int err;
+	int err = 0;
 
 	printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");
 
-- 
1.7.10.4

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

* Re: [PATCH] atm: fore200e.c: Cleaning up uninitialized variables
  2014-05-31 23:08 [PATCH] atm: fore200e.c: Cleaning up uninitialized variables Rickard Strandqvist
@ 2014-06-02  0:10 ` Olof Johansson
  2014-06-02 19:40   ` Rickard Strandqvist
       [not found]   ` <CAOesGMi4SGRP6_WMgv3xz_QrGScktYGQEK-muCrE=ohFBfeBeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Olof Johansson @ 2014-06-02  0:10 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Chas Williams, Grant Likely, Rob Herring, linux-atm-general,
	Network Development, linux-kernel, devicetree

On Sat, May 31, 2014 at 4:08 PM, Rickard Strandqvist
<rickard_strandqvist@spectrumdigital.se> wrote:
> 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/atm/fore200e.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
> index 204814e..d4725fc 100644
> --- a/drivers/atm/fore200e.c
> +++ b/drivers/atm/fore200e.c
> @@ -2780,7 +2780,7 @@ static struct pci_driver fore200e_pca_driver = {
>
>  static int __init fore200e_module_init(void)
>  {
> -       int err;
> +       int err = 0;
>
>         printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");


I can see how a tool that doesn't know about Kconfig dependencies
might think so, but if you look at Kconfig you'll see that for this
driver to be enabled for building either CONFIG_SBUS or CONFIG_PCI
must be set, and if either of them is then this variable will not be
used without first being set.


-Olof

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

* Re: [PATCH] atm: fore200e.c: Cleaning up uninitialized variables
  2014-06-02  0:10 ` Olof Johansson
@ 2014-06-02 19:40   ` Rickard Strandqvist
       [not found]   ` <CAOesGMi4SGRP6_WMgv3xz_QrGScktYGQEK-muCrE=ohFBfeBeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Rickard Strandqvist @ 2014-06-02 19:40 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Chas Williams, Grant Likely, Rob Herring, linux-atm-general,
	Network Development, linux-kernel, devicetree

Hi

No, regardless if it is a program that cppcheck or myself with limited
experience of kernel programming is not so easy to figure out.

But then I know that there is nothing wrong in this case, and that is
the main thing :-)

Best regards
Rickard Strandqvist


2014-06-02 2:10 GMT+02:00 Olof Johansson <olof@lixom.net>:
> On Sat, May 31, 2014 at 4:08 PM, Rickard Strandqvist
> <rickard_strandqvist@spectrumdigital.se> wrote:
>> 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/atm/fore200e.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
>> index 204814e..d4725fc 100644
>> --- a/drivers/atm/fore200e.c
>> +++ b/drivers/atm/fore200e.c
>> @@ -2780,7 +2780,7 @@ static struct pci_driver fore200e_pca_driver = {
>>
>>  static int __init fore200e_module_init(void)
>>  {
>> -       int err;
>> +       int err = 0;
>>
>>         printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");
>
>
> I can see how a tool that doesn't know about Kconfig dependencies
> might think so, but if you look at Kconfig you'll see that for this
> driver to be enabled for building either CONFIG_SBUS or CONFIG_PCI
> must be set, and if either of them is then this variable will not be
> used without first being set.
>
>
> -Olof

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

* Re: [PATCH] atm: fore200e.c: Cleaning up uninitialized variables
       [not found]   ` <CAOesGMi4SGRP6_WMgv3xz_QrGScktYGQEK-muCrE=ohFBfeBeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-06-03  0:11     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-06-03  0:11 UTC (permalink / raw)
  To: olof-nZhT3qVonbNeoWH0uzbU5w
  Cc: rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr,
	chas-vT06rRrALxcmhCb6mdbn6A, grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	linux-atm-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

From: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
Date: Sun, 1 Jun 2014 17:10:39 -0700

> On Sat, May 31, 2014 at 4:08 PM, Rickard Strandqvist
> <rickard_strandqvist-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org> wrote:
>> 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-IW2WV5XWFqGZkjO+N0TKoMugMpMbD5Xr@public.gmane.org>
>> ---
>>  drivers/atm/fore200e.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
>> index 204814e..d4725fc 100644
>> --- a/drivers/atm/fore200e.c
>> +++ b/drivers/atm/fore200e.c
>> @@ -2780,7 +2780,7 @@ static struct pci_driver fore200e_pca_driver = {
>>
>>  static int __init fore200e_module_init(void)
>>  {
>> -       int err;
>> +       int err = 0;
>>
>>         printk(FORE200E "FORE Systems 200E-series ATM driver - version " FORE200E_VERSION "\n");
> 
> 
> I can see how a tool that doesn't know about Kconfig dependencies
> might think so, but if you look at Kconfig you'll see that for this
> driver to be enabled for building either CONFIG_SBUS or CONFIG_PCI
> must be set, and if either of them is then this variable will not be
> used without first being set.

Yeah but it's harmless to apply this, which I've done.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2014-06-03  0:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-31 23:08 [PATCH] atm: fore200e.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-02  0:10 ` Olof Johansson
2014-06-02 19:40   ` Rickard Strandqvist
     [not found]   ` <CAOesGMi4SGRP6_WMgv3xz_QrGScktYGQEK-muCrE=ohFBfeBeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-03  0:11     ` David Miller

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).