From 31041f84ea62670d8e7eebfa07ce4b9ca05086dc Mon Sep 17 00:00:00 2001 From: guanyi3 Date: Fri, 6 Mar 2026 16:26:00 +0800 Subject: [PATCH] drivers/devfreq: fix qos_get_value returning wrong min/max aggregation QOS_REQ_MIN should return the highest value among all min requests (most restrictive lower bound), but plist_first returns the lowest. QOS_REQ_MAX should return the lowest value among all max requests (most restrictive upper bound), but plist_last returns the highest. This caused qos constraints to be ineffective. For example, two requests (32, 208000) and (104000, 104000) would merge to (32, 208000) instead of the correct (104000, 104000). Fix by using plist_last for QOS_REQ_MIN and plist_first for QOS_REQ_MAX. Signed-off-by: guanyi3 --- drivers/devfreq/devfreq_qos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq_qos.c b/drivers/devfreq/devfreq_qos.c index 501f30e3d63..9c0a34f453a 100644 --- a/drivers/devfreq/devfreq_qos.c +++ b/drivers/devfreq/devfreq_qos.c @@ -191,12 +191,12 @@ uint32_t qos_get_value(FAR struct qos_constraints_s *constraints, { case QOS_REQ_MIN: { - return plist_first(&constraints->min_requests)->prio; + return plist_last(&constraints->min_requests)->prio; } case QOS_REQ_MAX: { - return plist_last(&constraints->max_requests)->prio; + return plist_first(&constraints->max_requests)->prio; } }