haltest: Initialize local variables 59/287059/3
authorTaeminYeom <taemin.yeom@samsung.com>
Thu, 19 Jan 2023 07:23:20 +0000 (16:23 +0900)
committerTaeminYeom <taemin.yeom@samsung.com>
Thu, 19 Jan 2023 07:25:29 +0000 (16:25 +0900)
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>
haltest/board.cpp
haltest/display.cpp

index 4028b8e03b7dee7db3362db5f54b7429e5628a4a..a096801d3c9495dd5a06e96eda1f6e4f51b89755 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 e37bdaf2828043b8e833b108b6f0e0723670d870..9bb7e14c1925c785f4527b48c974bb6a4e90bf91 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");