lkml.org 
[lkml]   [2023]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [ARM] tcm: Add error handling for gen_pool_create in setup_tcm_pool
Date
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
\
 
 \ /
  Last update: 2023-11-29 07:16    [W:0.043 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site