Commit 5ec7805b authored by Patrick Mochel's avatar Patrick Mochel

network devices: move kobject registration earilier to better handle error.

Moved to just after the last other thing that can fail in register_netdevice().
parent 1e4d655e
......@@ -2520,6 +2520,11 @@ int register_netdevice(struct net_device *dev)
if (d == dev || !strcmp(d->name, dev->name))
goto out_err;
}
snprintf(dev->kobj.name,KOBJ_NAME_LEN,dev->name);
kobj_set_kset_s(dev,net_subsys);
if ((ret = kobject_register(&dev->kobj)))
goto out_err;
/*
* nil rebuild_header routine,
* that should be never called and used as just bug trap.
......@@ -2547,10 +2552,7 @@ int register_netdevice(struct net_device *dev)
notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
net_run_sbin_hotplug(dev, "register");
snprintf(dev->kobj.name,KOBJ_NAME_LEN,dev->name);
kobj_set_kset_s(dev,net_subsys);
ret = kobject_register(&dev->kobj);
ret = 0;
out:
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment