Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
sensor_smcf_drv/unit_test: Fix compiler error
Browse files Browse the repository at this point in the history
On gcc 13.2.0 the following error is flagged:
storing the address of local variable ‘data_api’ in
‘sensor_smcf_drv_ctx.data_api’ [-Werror=dangling-pointer=].

Storing a local pointer in a global variable should be avoided.

Signed-off-by: Tarek El-Sherbiny <[email protected]>
  • Loading branch information
tarek-arm committed Aug 15, 2024
1 parent 5a00810 commit 249524d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Arm SCP/MCP Software
* Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -288,6 +288,8 @@ void test_sensor_smcf_drv_get_sensor_single_value_success(void)
expected_sensor_value = (sensor_value_msb << 32) + sensor_value_lsb;
TEST_ASSERT_EQUAL_UINT64(sensor_value, expected_sensor_value);
}

sensor_smcf_drv_ctx.data_api = NULL;
}

void test_sensor_smcf_drv_get_sensor_single_value_fail_invalid_param(void)
Expand Down

0 comments on commit 249524d

Please sign in to comment.