From: Alex Chiang Date: Tue, 15 Dec 2009 01:59:07 +0000 (-0800) Subject: mm: refactor unregister_cpu_under_node() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9d52dad9447d0db4b52d67d5e9e9d339b5e8302;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm: refactor unregister_cpu_under_node() By returning early if the node is not online, we can unindent the interesting code by two levels. No functional change. Signed-off-by: Alex Chiang Cc: Gary Hade Cc: Badari Pulavarty Cc: Ingo Molnar Cc: David Rientjes Cc: Greg KH Cc: Randy Dunlap Cc: David Rientjes Cc: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/base/node.c b/drivers/base/node.c index eeae035dadc3..9b9acc39a1eb 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -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; }