b43: Fix swatch warning
authorLarry Finger <Larry.Finger@lwfinger.net>
Sat, 27 Aug 2011 20:53:42 +0000 (15:53 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Aug 2011 19:33:03 +0000 (15:33 -0400)
Swatch reports the following warning for main.c:

  CHECK   drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/main.c +4115 b43_wireless_core_stop(7) warn: variable dereferenced before check 'dev'

After analysis, this is not a bug, but a false warning. Nonetheless,
a cleanup is in order to prevent some future janitor proposing
the wrong fix, as I did in my original patch.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/main.c

index d2b1d1fe202b867b7716e65e26c2675d962fcb10..172294170df8e7777938b429257c334b0cad8856 100644 (file)
@@ -4131,10 +4131,13 @@ out_unlock:
  * because the core might be gone away while we unlocked the mutex. */
 static struct b43_wldev * b43_wireless_core_stop(struct b43_wldev *dev)
 {
-       struct b43_wl *wl = dev->wl;
+       struct b43_wl *wl;
        struct b43_wldev *orig_dev;
        u32 mask;
 
+       if (!dev)
+               return NULL;
+       wl = dev->wl;
 redo:
        if (!dev || b43_status(dev) < B43_STAT_STARTED)
                return dev;