mm: refactor unregister_cpu_under_node()
[pandora-kernel.git] / drivers / base / node.c
index eeae035..9b9acc3 100644 (file)
@@ -287,12 +287,18 @@ int register_cpu_under_node(unsigned int cpu, unsigned int nid)
 
 int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
 {
-       if (node_online(nid)) {
-               struct sys_device *obj = get_cpu_sysdev(cpu);
-               if (obj)
-                       sysfs_remove_link(&node_devices[nid].sysdev.kobj,
-                                        kobject_name(&obj->kobj));
-       }
+       struct sys_device *obj;
+
+       if (!node_online(nid))
+               return 0;
+
+       obj = get_cpu_sysdev(cpu);
+       if (!obj)
+               return 0;
+
+       sysfs_remove_link(&node_devices[nid].sysdev.kobj,
+                         kobject_name(&obj->kobj));
+
        return 0;
 }