diff options
Diffstat (limited to 'fs/ocfs2/cluster/nodemanager.c')
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index cfdb08b484ed..816a3f61330c 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -648,26 +648,19 @@ static struct config_item *o2nm_node_group_make_item(struct config_group *group, | |||
648 | const char *name) | 648 | const char *name) |
649 | { | 649 | { |
650 | struct o2nm_node *node = NULL; | 650 | struct o2nm_node *node = NULL; |
651 | struct config_item *ret = NULL; | ||
652 | 651 | ||
653 | if (strlen(name) > O2NM_MAX_NAME_LEN) | 652 | if (strlen(name) > O2NM_MAX_NAME_LEN) |
654 | goto out; /* ENAMETOOLONG */ | 653 | return ERR_PTR(-ENAMETOOLONG); |
655 | 654 | ||
656 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); | 655 | node = kzalloc(sizeof(struct o2nm_node), GFP_KERNEL); |
657 | if (node == NULL) | 656 | if (node == NULL) |
658 | goto out; /* ENOMEM */ | 657 | return ERR_PTR(-ENOMEM); |
659 | 658 | ||
660 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ | 659 | strcpy(node->nd_name, name); /* use item.ci_namebuf instead? */ |
661 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); | 660 | config_item_init_type_name(&node->nd_item, name, &o2nm_node_type); |
662 | spin_lock_init(&node->nd_lock); | 661 | spin_lock_init(&node->nd_lock); |
663 | 662 | ||
664 | ret = &node->nd_item; | 663 | return &node->nd_item; |
665 | |||
666 | out: | ||
667 | if (ret == NULL) | ||
668 | kfree(node); | ||
669 | |||
670 | return ret; | ||
671 | } | 664 | } |
672 | 665 | ||
673 | static void o2nm_node_group_drop_item(struct config_group *group, | 666 | static void o2nm_node_group_drop_item(struct config_group *group, |
@@ -762,7 +755,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g | |||
762 | /* this runs under the parent dir's i_mutex; there can be only | 755 | /* this runs under the parent dir's i_mutex; there can be only |
763 | * one caller in here at a time */ | 756 | * one caller in here at a time */ |
764 | if (o2nm_single_cluster) | 757 | if (o2nm_single_cluster) |
765 | goto out; /* ENOSPC */ | 758 | return ERR_PTR(-ENOSPC); |
766 | 759 | ||
767 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); | 760 | cluster = kzalloc(sizeof(struct o2nm_cluster), GFP_KERNEL); |
768 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); | 761 | ns = kzalloc(sizeof(struct o2nm_node_group), GFP_KERNEL); |
@@ -795,6 +788,7 @@ out: | |||
795 | kfree(ns); | 788 | kfree(ns); |
796 | o2hb_free_hb_set(o2hb_group); | 789 | o2hb_free_hb_set(o2hb_group); |
797 | kfree(defs); | 790 | kfree(defs); |
791 | ret = ERR_PTR(-ENOMEM); | ||
798 | } | 792 | } |
799 | 793 | ||
800 | return ret; | 794 | return ret; |