From e8c14b7cac1a2f786a79be8a1814096056d4c9c1 Mon Sep 17 00:00:00 2001 From: Unsung Lee Date: Thu, 4 Jul 2024 11:34:16 +0900 Subject: [PATCH] storage: Add error return value of init_storage_config_info_all Add an error return value of init_storage_config_info_all() to check error status of the function. Change-Id: Ie87dd897ced417dac0d2a7526bc1f57080a57dc3 Signed-off-by: Unsung Lee --- src/storage/storage.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/storage/storage.c b/src/storage/storage.c index 4553459..5373b2f 100644 --- a/src/storage/storage.c +++ b/src/storage/storage.c @@ -527,8 +527,16 @@ static int init_storage_config_info_all(void) init_storage_config_info(MEMORY_STATUS_OPT_PATH, &storage_opt_info); memnoti_timer = g_timeout_add(MEMNOTI_TIMER_INTERVAL, check_storage_status, NULL); - if (memnoti_timer == 0) + + /** + * If allocation or initialization of the internal resource fails, + * g_timeout_add() returns 0 as id of the resource. + */ + if (memnoti_timer == 0) { _E("Failed mem available noti timer add."); + return -EWOULDBLOCK; + } + return 0; } @@ -679,7 +687,7 @@ static void booting_done(void) _E("Failed to register dm_verity uevent: %d", ret_val); } - if (init_storage_config_info_all() == -1) + if (init_storage_config_info_all() < 0) _E("Failed to remain mem noti control fd init."); } -- 2.34.1