From 114ffef75a9f0e3ddf80ca6f92016da1ecd21f25 Mon Sep 17 00:00:00 2001 From: Md Golam Tanvir Zim Date: Thu, 9 Jan 2025 11:09:08 +0000 Subject: [PATCH] scmi_clock: Fix clock index in clock extended name handler The clock device table is indexed by scmi index of a clock, not device index. This fixes the clock extended name handler where device index was used in a device table instead of scmi index. Signed-off-by: Md Golam Tanvir Zim Change-Id: I6a0677879ddee789634fc561959cbc9ea9540d41 --- module/scmi_clock/src/mod_scmi_clock.c | 8 +++----- module/scmi_clock/test/mod_scmi_clock_unit_test.c | 6 +----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/module/scmi_clock/src/mod_scmi_clock.c b/module/scmi_clock/src/mod_scmi_clock.c index 633fb6f50..f92eb5344 100644 --- a/module/scmi_clock/src/mod_scmi_clock.c +++ b/module/scmi_clock/src/mod_scmi_clock.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -1520,7 +1520,7 @@ static int scmi_clock_name_get_handler( const uint32_t *payload) { int status, respond_status; - unsigned int agent_id, clock_dev_idx; + unsigned int agent_id; const struct mod_scmi_clock_device *clock_device; size_t response_size; const struct scmi_clock_name_get_a2p *parameters; @@ -1553,9 +1553,7 @@ static int scmi_clock_name_get_handler( return status; } - clock_dev_idx = - scmi_clock_get_clock_device_idx(agent_id, parameters->clock_id); - if (!clock_has_extended_name(agent_id, clock_dev_idx)) { + if (!clock_has_extended_name(agent_id, parameters->clock_id)) { return_values.status = (int32_t)SCMI_NOT_SUPPORTED; goto exit; } diff --git a/module/scmi_clock/test/mod_scmi_clock_unit_test.c b/module/scmi_clock/test/mod_scmi_clock_unit_test.c index 8d568c6f0..2a0332057 100644 --- a/module/scmi_clock/test/mod_scmi_clock_unit_test.c +++ b/module/scmi_clock/test/mod_scmi_clock_unit_test.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -1173,8 +1173,6 @@ void test_scmi_clock_name_get_handler_success(void) mod_scmi_from_protocol_api_get_agent_id_ExpectAnyArgsAndReturn(FWK_SUCCESS); mod_scmi_from_protocol_api_get_agent_id_ReturnThruPtr_agent_id(&agent_id); - fwk_id_get_element_idx_ExpectAnyArgsAndReturn(CLOCK_DEV_IDX_FAKE1); - fwk_id_get_element_idx_ExpectAnyArgsAndReturn(CLOCK_DEV_IDX_FAKE1); fwk_id_is_equal_ExpectAnyArgsAndReturn(true); @@ -1227,8 +1225,6 @@ void test_scmi_clock_name_get_handler_extended_name_not_supported(void) mod_scmi_from_protocol_api_get_agent_id_ExpectAnyArgsAndReturn(FWK_SUCCESS); mod_scmi_from_protocol_api_get_agent_id_ReturnThruPtr_agent_id(&agent_id); - fwk_id_get_element_idx_ExpectAnyArgsAndReturn(CLOCK_DEV_IDX_FAKE0); - mod_scmi_from_protocol_api_respond_Stub( clock_has_extended_name_callback); -- GitLab