Messages in this thread Patch in this message | | | From | Haoran Liu <> | Subject | [PATCH] [ARM] tcm: Add error handling for gen_pool_create in setup_tcm_pool | Date | Tue, 28 Nov 2023 22:15:08 -0800 |
| |
The new code checks the return value of gen_pool_create, and if it indicates an error, the setup process is aborted, and an appropriate error code is returned. This ensures that the TCM pool setup does not silently fail.
Signed-off-by: Haoran Liu <liuhaoran14@163.com> --- arch/arm/kernel/tcm.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c index f59927bcfbce..df25d310abc3 100644 --- a/arch/arm/kernel/tcm.c +++ b/arch/arm/kernel/tcm.c @@ -393,6 +393,10 @@ static int __init setup_tcm_pool(void) * line alignments does not matter in TCM! */ tcm_pool = gen_pool_create(2, -1); + if (!tcm_pool) { + pr_err("Failed to create TCM memory pool\n"); + return -ENOMEM; + } pr_debug("Setting up TCM memory pool\n"); -- 2.17.1
| |