[PATCH] lib/stackdepot : Remove logically dead code in stack_depot_init()
From: Chelsy Ratnawat
Date: Fri Oct 16 2026 - 02:20:36 EST
Since scale is always greater than PAGE_SHIFT, remove the
unreachable else branch and simplify the conditional shift.
This issue was reported by Coverity scan.
Signed-off-by: Chelsy Ratnawat <chelsyratnawat2001@xxxxxxxxx>
---
lib/stackdepot.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index dd2717ff94bf..0393801ab1d9 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -247,11 +247,7 @@ int stack_depot_init(void)
entries = nr_free_buffer_pages();
entries = roundup_pow_of_two(entries);
-
- if (scale > PAGE_SHIFT)
- entries >>= (scale - PAGE_SHIFT);
- else
- entries <<= (PAGE_SHIFT - scale);
+ entries >>= (scale - PAGE_SHIFT);
}
if (entries < 1UL << STACK_BUCKET_NUMBER_ORDER_MIN)
--
2.53.0