device: initialize dev->set_state for virtual devices
authorFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 13:06:09 +0000 (15:06 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 5 Jul 2012 13:10:43 +0000 (15:10 +0200)
device.c

index 82c83d1e46f5081d4f5672a56be0139f0b6d6bf2..017fe03609e8cb12042aa832498d9d252d92639c 100644 (file)
--- a/device.c
+++ b/device.c
@@ -346,6 +346,9 @@ void device_init_virtual(struct device *dev, const struct device_type *type, con
        D(DEVICE, "Initialize device '%s'\n", dev->ifname);
        INIT_LIST_HEAD(&dev->users);
        dev->type = type;
+
+       if (!dev->set_state)
+               dev->set_state = set_device_state;
 }
 
 int device_init(struct device *dev, const struct device_type *type, const char *ifname)
@@ -354,9 +357,6 @@ int device_init(struct device *dev, const struct device_type *type, const char *
 
        device_init_virtual(dev, type, ifname);
 
-       if (!dev->set_state)
-               dev->set_state = set_device_state;
-
        dev->avl.key = dev->ifname;
 
        ret = avl_insert(&devices, &dev->avl);