aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/msi_bitmap.c
diff options
context:
space:
mode:
authorGuo Weikang <[email protected]>2025-01-02 07:25:28 +0000
committerAndrew Morton <[email protected]>2025-01-26 04:22:38 +0000
commitc6f239796b55dbc4225a6fca9f96232092b9df83 (patch)
treed741398d6afb6bc2a736fae13ed589ceb5b679e7 /arch/powerpc/sysdev/msi_bitmap.c
parentmm: make mmap_region() internal (diff)
downloadkernel-c6f239796b55dbc4225a6fca9f96232092b9df83.tar.gz
kernel-c6f239796b55dbc4225a6fca9f96232092b9df83.zip
mm/memblock: add memblock_alloc_or_panic interface
Before SLUB initialization, various subsystems used memblock_alloc to allocate memory. In most cases, when memory allocation fails, an immediate panic is required. To simplify this behavior and reduce repetitive checks, introduce `memblock_alloc_or_panic`. This function ensures that memory allocation failures result in a panic automatically, improving code readability and consistency across subsystems that require this behavior. [[email protected]: arch/s390: save_area_alloc default failure behavior changed to panic] Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/lkml/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Guo Weikang <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Reviewed-by: Alexander Gordeev <[email protected]> [s390] Acked-by: Mike Rapoport (Microsoft) <[email protected]> Cc: Alexander Gordeev <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'arch/powerpc/sysdev/msi_bitmap.c')
-rw-r--r--arch/powerpc/sysdev/msi_bitmap.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
index 0b6e37f3ffb8..456a4f64ae0a 100644
--- a/arch/powerpc/sysdev/msi_bitmap.c
+++ b/arch/powerpc/sysdev/msi_bitmap.c
@@ -124,10 +124,7 @@ int __ref msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
if (bmp->bitmap_from_slab)
bmp->bitmap = kzalloc(size, GFP_KERNEL);
else {
- bmp->bitmap = memblock_alloc(size, SMP_CACHE_BYTES);
- if (!bmp->bitmap)
- panic("%s: Failed to allocate %u bytes\n", __func__,
- size);
+ bmp->bitmap = memblock_alloc_or_panic(size, SMP_CACHE_BYTES);
/* the bitmap won't be freed from memblock allocator */
kmemleak_not_leak(bmp->bitmap);
}