From 249524daa2f9231969384a79be2523c2f2e98b22 Mon Sep 17 00:00:00 2001 From: Tarek El-Sherbiny Date: Fri, 9 Aug 2024 15:53:33 +0100 Subject: [PATCH] sensor_smcf_drv/unit_test: Fix compiler error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c b/module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c index b595bc179..c6bfdf0c2 100644 --- a/module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c +++ b/module/sensor_smcf_drv/test/mod_sensor_smcf_drv_unit_test.c @@ -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 */ @@ -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)