wireless: fix handling of wdev->config_state, prevent handling of multiple state...
authorFelix Fietkau <nbd@openwrt.org>
Wed, 11 Dec 2013 18:20:19 +0000 (19:20 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 11 Dec 2013 18:21:54 +0000 (19:21 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
wireless.c

index 34603372903b14ea12c88236ce111587ccdac2fc..a4d7c26e71763c2cfb60b57fd79cf136831434fb 100644 (file)
@@ -281,10 +281,10 @@ wdev_handle_config_change(struct wireless_device *wdev)
 {
        enum interface_config_state state = wdev->config_state;
 
-       wdev->config_state = IFC_NORMAL;
        switch(state) {
        case IFC_NORMAL:
        case IFC_RELOAD:
+               wdev->config_state = IFC_NORMAL;
                if (wdev->autostart)
                        __wireless_device_set_up(wdev);
                break;
@@ -395,12 +395,10 @@ wireless_device_set_down(struct wireless_device *wdev)
 static void
 wdev_set_config_state(struct wireless_device *wdev, enum interface_config_state s)
 {
-       enum interface_config_state old_state = wdev->config_state;
-
-       wdev->config_state = s;
-       if (old_state != IFC_NORMAL)
+       if (wdev->config_state != IFC_NORMAL)
                return;
 
+       wdev->config_state = s;
        if (wdev->state == IFS_DOWN)
                wdev_handle_config_change(wdev);
        else