From f2f6c1d6b41e8aa557c19b58e977bde634bab779 Mon Sep 17 00:00:00 2001 From: Tony Han Date: Mon, 9 Dec 2024 10:53:59 +0800 Subject: [PATCH] drivers: scmi-msg: fix clock min/max/step triplet description support The return value of plat_scmi_clock_rates_array() is one of "SCMI_DENIED", "SCMI_GENERIC_ERROR" and "SCMI_SUCCESS". The code in scmi_clock_describe_rates() for clock min/max/step triplet description support would never be executed due to the return value of plat_scmi_clock_rates_array() could never be "SCMI_NOT_SUPPORTED". Fix by modifying the return value of plat_scmi_clock_rates_array(). Signed-off-by: Tony Han Reviewed-by: Etienne Carriere --- core/drivers/scmi-msg/clock_generic.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/drivers/scmi-msg/clock_generic.c b/core/drivers/scmi-msg/clock_generic.c index 1b2d1e6cf24..bd08cb0218b 100644 --- a/core/drivers/scmi-msg/clock_generic.c +++ b/core/drivers/scmi-msg/clock_generic.c @@ -82,16 +82,20 @@ int32_t plat_scmi_clock_rates_array(unsigned int channel_id, unsigned long *rates, size_t *nb_elts) { + TEE_Result res = TEE_ERROR_GENERIC; struct scmi_clk *clk = NULL; clk = clk_scmi_get_by_id(channel_id, scmi_id); if (!clk) return SCMI_DENIED; - if (clk_get_rates_array(clk->clk, start_index, rates, nb_elts)) + res = clk_get_rates_array(clk->clk, start_index, rates, nb_elts); + if (res == TEE_SUCCESS) + return SCMI_SUCCESS; + else if (res == TEE_ERROR_NOT_SUPPORTED) + return SCMI_NOT_SUPPORTED; + else return SCMI_GENERIC_ERROR; - - return SCMI_SUCCESS; } unsigned long plat_scmi_clock_get_rate(unsigned int channel_id,