]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/hugetlb: enforce brace style
authorJoshua Hahn <joshua.hahnjy@gmail.com>
Fri, 16 Jan 2026 19:27:16 +0000 (14:27 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 31 Jan 2026 22:22:39 +0000 (14:22 -0800)
Documentation/process/coding-style.rst explicitly notes that if only one
branch of a conditional statement is a single statement, braces should be
used in both branches.  Enforce this in mm/hugetlb.c.

While add it, fix the indentation for vma_end_reservation.

No functional change intended.

Link: https://lkml.kernel.org/r/20260116192717.1600049-2-joshua.hahnjy@gmail.com
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c

index a84869d33bed235c4ec675b7aec5c4bd688a7df0..9c7efad6fa485b020c03955ba91e7512b26b9282 100644 (file)
@@ -578,8 +578,9 @@ hugetlb_resv_map_add(struct resv_map *map, struct list_head *rg, long from,
                record_hugetlb_cgroup_uncharge_info(cg, h, map, nrg);
                list_add(&nrg->link, rg);
                coalesce_file_region(map, nrg);
-       } else
+       } else {
                *regions_needed += 1;
+       }
 
        return to - from;
 }
@@ -1247,8 +1248,9 @@ void hugetlb_dup_vma_private(struct vm_area_struct *vma)
 
                if (vma_lock && vma_lock->vma != vma)
                        vma->vm_private_data = NULL;
-       } else
+       } else {
                vma->vm_private_data = NULL;
+       }
 }
 
 /*
@@ -2076,8 +2078,9 @@ retry:
                                h->max_huge_pages++;
                                goto out;
                        }
-               } else
+               } else {
                        rc = 0;
+               }
 
                update_and_free_hugetlb_folio(h, folio, false);
                return rc;
@@ -2672,11 +2675,12 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma,
                                 * be consumed on a subsequent allocation.
                                 */
                                folio_set_hugetlb_restore_reserve(folio);
-               } else
+               } else {
                        /*
                         * No reservation present, do nothing
                         */
-                        vma_end_reservation(h, vma, address);
+                       vma_end_reservation(h, vma, address);
+               }
        }
 }
 
@@ -4672,10 +4676,12 @@ static void hugetlb_vm_op_open(struct vm_area_struct *vma)
                        if (vma_lock->vma != vma) {
                                vma->vm_private_data = NULL;
                                hugetlb_vma_lock_alloc(vma);
-                       } else
+                       } else {
                                pr_warn("HugeTLB: vma_lock already exists in %s.\n", __func__);
-               } else
+                       }
+               } else {
                        hugetlb_vma_lock_alloc(vma);
+               }
        }
 }