---
 src/device.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/device.c b/src/device.c
index 2745893..65bb8f6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -300,8 +300,6 @@ static int set_powered(struct connman_device *device, 
connman_bool_t powered)
        if (device->powered_pending == powered)
                return -EALREADY;
 
-       device->powered_pending = powered;
-
        if (!driver)
                return -EINVAL;
 
@@ -309,12 +307,18 @@ static int set_powered(struct connman_device *device, 
connman_bool_t powered)
 
        if (powered == TRUE) {
                if (driver->enable) {
+
+                       device->powered_pending = powered;
+
                        err = driver->enable(device);
                        if (err == 0)
                                __connman_notifier_enable(type);
                } else
                        err = -EINVAL;
        } else {
+
+               device->powered_pending = powered;
+
                clear_scan_trigger(device);
 
                g_hash_table_remove_all(device->networks);
-- 
1.6.1.3

_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to