mm: refactor register_cpu_under_node()
[linux-2.6.git] / drivers / base / node.c
index 44eed11..eeae035 100644 (file)
@@ -271,16 +271,18 @@ struct node node_devices[MAX_NUMNODES];
  */
 int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 {
-       if (node_online(nid)) {
-               struct sys_device *obj = get_cpu_sysdev(cpu);
-               if (!obj)
-                       return 0;
-               return sysfs_create_link(&node_devices[nid].sysdev.kobj,
-                                        &obj->kobj,
-                                        kobject_name(&obj->kobj));
-        }
+       struct sys_device *obj;
 
-       return 0;
+       if (!node_online(nid))
+               return 0;
+
+       obj = get_cpu_sysdev(cpu);
+       if (!obj)
+               return 0;
+
+       return sysfs_create_link(&node_devices[nid].sysdev.kobj,
+                               &obj->kobj,
+                               kobject_name(&obj->kobj));
 }
 
 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)