From: Unsung Lee Date: Thu, 4 Jul 2024 02:34:16 +0000 (+0900) Subject: storage: Add error return value of init_storage_config_info_all X-Git-Tag: accepted/tizen/unified/x/20240708.080630^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified_dev;p=platform%2Fcore%2Fsystem%2Fstoraged.git 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 --- 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."); }