[PATCH] bcm43xx: fix iwmode crash when down
authorMichael Buesch <mb@bu3sch.de>
Mon, 1 May 2006 20:43:00 +0000 (22:43 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 5 May 2006 20:55:23 +0000 (16:55 -0400)
This fixes a crash when

iwconfig ethX mode foo

is done before

ifconfig ethX up

or after

ifconfig ethX down

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/bcm43xx/bcm43xx_wx.c

index 3edbb481a0a035ebd957decbe43a76cad3c294e6..b45063974ae9dd196b93bb7a310bf2c62c7b5f3a 100644 (file)
@@ -182,8 +182,11 @@ static int bcm43xx_wx_set_mode(struct net_device *net_dev,
                mode = BCM43xx_INITIAL_IWMODE;
 
        bcm43xx_lock_mmio(bcm, flags);
-       if (bcm->ieee->iw_mode != mode)
-               bcm43xx_set_iwmode(bcm, mode);
+       if (bcm->initialized) {
+               if (bcm->ieee->iw_mode != mode)
+                       bcm43xx_set_iwmode(bcm, mode);
+       } else
+               bcm->ieee->iw_mode = mode;
        bcm43xx_unlock_mmio(bcm, flags);
 
        return 0;