diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5a16d892c891c..729706f55dce0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2618,8 +2618,10 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent, return -ENOMEM; retval = sysfs_create_group(hstate_kobjs[hi], hstate_attr_group); - if (retval) + if (retval) { kobject_put(hstate_kobjs[hi]); + hstate_kobjs[hi] = NULL; + } return retval; }