storage: Add error return value of init_storage_config_info_all 67/313967/6 accepted/tizen_unified_dev accepted/tizen_unified_toolchain accepted/tizen/9.0/unified/20241030.235232 accepted/tizen/unified/20240708.103301 accepted/tizen/unified/dev/20240709.043402 accepted/tizen/unified/toolchain/20240812.132012 accepted/tizen/unified/x/20240708.080630 accepted/tizen/unified/x/asan/20240813.230257 tizen_9.0_m2_release
authorUnsung Lee <unsung.lee@samsung.com>
Thu, 4 Jul 2024 02:34:16 +0000 (11:34 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Fri, 5 Jul 2024 04:58:45 +0000 (13:58 +0900)
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 <unsung.lee@samsung.com>
src/storage/storage.c

index 455345998af2967ebcce91175e1eb0048c8eddae..5373b2ff650865d59c1daf2c9f02a9c9076acfba 100644 (file)
@@ -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.");
 }