This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 31041f84ea62670d8e7eebfa07ce4b9ca05086dc
Author: guanyi3 <[email protected]>
AuthorDate: Fri Mar 6 16:26:00 2026 +0800

    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 <[email protected]>
---
 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;
         }
     }
 

Reply via email to