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

Commit

Permalink
amu_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
‘amu_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 <tarek.el-sherbiny@arm.com>
  • Loading branch information
tarek-arm committed Aug 15, 2024
1 parent ed7e163 commit 2da65a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion module/amu_smcf_drv/test/mod_amu_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) 2023, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2023-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -269,6 +269,7 @@ void test_amu_smcf_drv_get_amu_counter_success(void)
.get_data = test_smcf_get_data_api,
};
amu_smcf_drv_ctx.data_api = &data_api;

uint64_t amu_counter_values[10];

for (i = 1; i < NUM_OF_CORES; ++i) {
Expand Down Expand Up @@ -301,6 +302,8 @@ void test_amu_smcf_drv_get_amu_counter_success(void)
}
}
}

amu_smcf_drv_ctx.data_api = NULL;
}

void test_amu_smcf_drv_get_amu_counter_fail_invalid_param(void)
Expand Down

0 comments on commit 2da65a4

Please sign in to comment.