linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: avoid uninitialized var warning in ieee80211_scan_cancel
@ 2010-10-06 20:42 John W. Linville
  2010-10-07  6:15 ` Stanislaw Gruszka
  0 siblings, 1 reply; 3+ messages in thread
From: John W. Linville @ 2010-10-06 20:42 UTC (permalink / raw)
  To: linux-wireless; +Cc: sgruszka, johannes, John W. Linville

net/mac80211/scan.c: In function ‘ieee80211_scan_cancel’:
net/mac80211/scan.c:794: warning: ‘finish’ may be used uninitialized in this function

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 net/mac80211/scan.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 80e017d..523db93 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -791,7 +791,8 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
  */
 void ieee80211_scan_cancel(struct ieee80211_local *local)
 {
-	bool abortscan, finish;
+	bool abortscan;
+	bool finish = false;
 
 	/*
 	 * We are only canceling software scan, or deferred scan that was not
@@ -818,7 +819,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
 	if (abortscan) {
 		/* The scan is canceled, but stop work from being pending */
 		cancel_delayed_work_sync(&local->scan_work);
-		if (finish)
-			__ieee80211_scan_completed_finish(&local->hw, false);
 	}
+	if (finish)
+		__ieee80211_scan_completed_finish(&local->hw, false);
 }
-- 
1.7.2.3


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

* Re: [PATCH] mac80211: avoid uninitialized var warning in ieee80211_scan_cancel
  2010-10-06 20:42 [PATCH] mac80211: avoid uninitialized var warning in ieee80211_scan_cancel John W. Linville
@ 2010-10-07  6:15 ` Stanislaw Gruszka
  2010-10-07 13:06   ` John W. Linville
  0 siblings, 1 reply; 3+ messages in thread
From: Stanislaw Gruszka @ 2010-10-07  6:15 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, johannes

On Wed, Oct 06, 2010 at 04:42:23PM -0400, John W. Linville wrote:
> net/mac80211/scan.c: In function ‘ieee80211_scan_cancel’:
> net/mac80211/scan.c:794: warning: ‘finish’ may be used uninitialized in this function
> 
> Signed-off-by: John W. Linville <linville@tuxdriver.com>

Hi John

What compiler are you using? I have no warning with gcc 4.4.4 from RHEL6.
That's correct, as "finish" variable can not be uninitialized, because is used
only when abortscan == true;

> +	bool finish = false;
>  
>  	/*
>  	 * We are only canceling software scan, or deferred scan that was not
> @@ -818,7 +819,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
>  	if (abortscan) {
>  		/* The scan is canceled, but stop work from being pending */
>  		cancel_delayed_work_sync(&local->scan_work);
> -		if (finish)
> -			__ieee80211_scan_completed_finish(&local->hw, false);
>  	}
> +	if (finish)
> +		__ieee80211_scan_completed_finish(&local->hw, false);
>  }

I have nothing against the patch, but this seems to be compiler problem,
not our code.

Stanislaw

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

* Re: [PATCH] mac80211: avoid uninitialized var warning in ieee80211_scan_cancel
  2010-10-07  6:15 ` Stanislaw Gruszka
@ 2010-10-07 13:06   ` John W. Linville
  0 siblings, 0 replies; 3+ messages in thread
From: John W. Linville @ 2010-10-07 13:06 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, johannes

On Thu, Oct 07, 2010 at 08:15:16AM +0200, Stanislaw Gruszka wrote:
> On Wed, Oct 06, 2010 at 04:42:23PM -0400, John W. Linville wrote:
> > net/mac80211/scan.c: In function ‘ieee80211_scan_cancel’:
> > net/mac80211/scan.c:794: warning: ‘finish’ may be used uninitialized in this function
> > 
> > Signed-off-by: John W. Linville <linville@tuxdriver.com>
> 
> Hi John
> 
> What compiler are you using? I have no warning with gcc 4.4.4 from RHEL6.
> That's correct, as "finish" variable can not be uninitialized, because is used
> only when abortscan == true;

[linville-8530p.local]:> gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile
--enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.4 20100630 (Red Hat 4.4.4-10) (GCC) 

/home/linville
[linville-8530p.local]:> cat /etc/redhat-release 
Fedora release 13 (Goddard)

> > +	bool finish = false;
> >  
> >  	/*
> >  	 * We are only canceling software scan, or deferred scan that was not
> > @@ -818,7 +819,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
> >  	if (abortscan) {
> >  		/* The scan is canceled, but stop work from being pending */
> >  		cancel_delayed_work_sync(&local->scan_work);
> > -		if (finish)
> > -			__ieee80211_scan_completed_finish(&local->hw, false);
> >  	}
> > +	if (finish)
> > +		__ieee80211_scan_completed_finish(&local->hw, false);
> >  }
> 
> I have nothing against the patch, but this seems to be compiler problem,
> not our code.

I'd rather just avoid the warning spam. :-)

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

end of thread, other threads:[~2010-10-07 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 20:42 [PATCH] mac80211: avoid uninitialized var warning in ieee80211_scan_cancel John W. Linville
2010-10-07  6:15 ` Stanislaw Gruszka
2010-10-07 13:06   ` John W. Linville

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