Merge tag 'for-5.11/io_uring-2020-12-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / mm / hugetlb.c
index f94c673..cbf32d2 100644 (file)
@@ -2760,7 +2760,7 @@ static ssize_t nr_hugepages_show_common(struct kobject *kobj,
        else
                nr_huge_pages = h->nr_huge_pages_node[nid];
 
-       return sprintf(buf, "%lu\n", nr_huge_pages);
+       return sysfs_emit(buf, "%lu\n", nr_huge_pages);
 }
 
 static ssize_t __nr_hugepages_store_common(bool obey_mempolicy,
@@ -2833,7 +2833,8 @@ HSTATE_ATTR(nr_hugepages);
  * huge page alloc/free.
  */
 static ssize_t nr_hugepages_mempolicy_show(struct kobject *kobj,
-                                      struct kobj_attribute *attr, char *buf)
+                                          struct kobj_attribute *attr,
+                                          char *buf)
 {
        return nr_hugepages_show_common(kobj, attr, buf);
 }
@@ -2851,7 +2852,7 @@ static ssize_t nr_overcommit_hugepages_show(struct kobject *kobj,
                                        struct kobj_attribute *attr, char *buf)
 {
        struct hstate *h = kobj_to_hstate(kobj, NULL);
-       return sprintf(buf, "%lu\n", h->nr_overcommit_huge_pages);
+       return sysfs_emit(buf, "%lu\n", h->nr_overcommit_huge_pages);
 }
 
 static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,
@@ -2889,7 +2890,7 @@ static ssize_t free_hugepages_show(struct kobject *kobj,
        else
                free_huge_pages = h->free_huge_pages_node[nid];
 
-       return sprintf(buf, "%lu\n", free_huge_pages);
+       return sysfs_emit(buf, "%lu\n", free_huge_pages);
 }
 HSTATE_ATTR_RO(free_hugepages);
 
@@ -2897,7 +2898,7 @@ static ssize_t resv_hugepages_show(struct kobject *kobj,
                                        struct kobj_attribute *attr, char *buf)
 {
        struct hstate *h = kobj_to_hstate(kobj, NULL);
-       return sprintf(buf, "%lu\n", h->resv_huge_pages);
+       return sysfs_emit(buf, "%lu\n", h->resv_huge_pages);
 }
 HSTATE_ATTR_RO(resv_hugepages);
 
@@ -2914,7 +2915,7 @@ static ssize_t surplus_hugepages_show(struct kobject *kobj,
        else
                surplus_huge_pages = h->surplus_huge_pages_node[nid];
 
-       return sprintf(buf, "%lu\n", surplus_huge_pages);
+       return sysfs_emit(buf, "%lu\n", surplus_huge_pages);
 }
 HSTATE_ATTR_RO(surplus_hugepages);
 
@@ -5113,6 +5114,7 @@ int hugetlb_reserve_pages(struct inode *inode,
 
                if (unlikely(add < 0)) {
                        hugetlb_acct_memory(h, -gbl_reserve);
+                       ret = add;
                        goto out_put_pages;
                } else if (unlikely(chg > add)) {
                        /*