haltest: Initialize local variables 06/287106/1
authorTaeminYeom <taemin.yeom@samsung.com>
Thu, 19 Jan 2023 07:23:20 +0000 (16:23 +0900)
committerTaemin Yeom <taemin.yeom@samsung.com>
Fri, 20 Jan 2023 01:32:49 +0000 (01:32 +0000)
These local variables are used to get the values in the
hal backend function with pointer.
If there is an error in hal backend function,
it is possible to use uninitialized local variables.

Change-Id: I43eadbe13f19e8fb3bd9537b610db6bc773b7d6f
Signed-off-by: TaeminYeom <taemin.yeom@samsung.com>
(cherry picked from commit 07c580d769debb88afa55dc83a3a9f36fde2684f)

haltest/board.cpp
haltest/display.cpp

index 4028b8e..a096801 100644 (file)
@@ -36,7 +36,7 @@ TEST_F(BOARD, GetDeviceSerialP)
 TEST_F(BOARD, GetDeviceRevisionP)
 {
        int ret_val;
-       int revision;
+       int revision = 0;
 
        ret_val = hal_device_board_get_device_revision(&revision);
        if (ret_val == -ENODEV) {
index e37bdaf..9bb7e14 100644 (file)
@@ -284,7 +284,7 @@ TEST_F(DISPLAY, SetImageEffectP)
 {
        int ret_val;
        int set_image_effect, get_image_effect;
-       enum display_image_effect get_image_effect_raw;
+       enum display_image_effect get_image_effect_raw = DISPLAY_IMAGE_EFFECT_STANDARD;
 
        if (!DISPLAY::supported) {
                SKIP_MESSAGE("Display not supported");
@@ -336,7 +336,7 @@ TEST_F(DISPLAY, SetPanelModeP)
 {
        int ret_val;
        int panel_mode;
-       enum display_panel_mode panel_mode_raw;
+       enum display_panel_mode panel_mode_raw = DISPLAY_PANEL_MODE_STANDARD;
 
        if (!DISPLAY::supported) {
                SKIP_MESSAGE("Display not supported");
@@ -460,7 +460,7 @@ TEST_F(DISPLAY, GetFrameRateP)
 
 TEST_F(DISPLAY, SetFrameRateP)
 {
-       int ret_val, fmax;
+       int ret_val, fmax = 0;
 
        if (!DISPLAY::supported) {
                SKIP_MESSAGE("Display not supported");