From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail172.messagelabs.com (mail172.messagelabs.com [216.82.254.3]) by kanga.kvack.org (Postfix) with ESMTP id 1CB0B6B004F for ; Mon, 19 Oct 2009 17:34:22 -0400 (EDT) Subject: [PATCH 2/5] mm: refactor register_cpu_under_node() From: Alex Chiang Date: Mon, 19 Oct 2009 15:34:20 -0600 Message-ID: <20091019213420.32729.45505.stgit@bob.kio> In-Reply-To: <20091019212740.32729.7171.stgit@bob.kio> References: <20091019212740.32729.7171.stgit@bob.kio> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org List-ID: By returning early if the node is not online, we can unindent the interesting code by one level. No functional change. Signed-off-by: Alex Chiang --- drivers/base/node.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 3108b21..ef7dd22 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -227,16 +227,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) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org