summaryrefslogtreecommitdiffstats
path: root/drivers/base/node.c
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2018-03-11 11:25:50 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-15 14:37:04 +0100
commitc1cc0d51140fbcbb3c8cb08ee7e92020dda9c1af (patch)
tree29cf3bc2e24fc505ff4daf2331412df30d433db7 /drivers/base/node.c
parentc8ae1674cd0d688661a8b85b8b2d940516933322 (diff)
downloadlinux-c1cc0d51140fbcbb3c8cb08ee7e92020dda9c1af.tar.bz2
driver core: node: use put_device() if device_register fail
if device_register() returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/node.c')
-rw-r--r--drivers/base/node.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/base/node.c b/drivers/base/node.c
index ee090ab9171c..c5f81fc621ac 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -315,7 +315,9 @@ static int register_node(struct node *node, int num)
node->dev.groups = node_dev_groups;
error = device_register(&node->dev);
- if (!error){
+ if (error)
+ put_device(&node->dev);
+ else {
hugetlb_register_node(node);
compaction_register_node(node);