Patch "PM / devfreq: Fix devfreq_notifier_call returning errno" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PM / devfreq: Fix devfreq_notifier_call returning errno

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pm-devfreq-fix-devfreq_notifier_call-returning-errno.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 6a893a68216f3e05a434cdd18cef95a60f9db70d
Author: Leonard Crestez <leonard.crestez@xxxxxxx>
Date:   Thu Oct 31 23:34:18 2019 +0200

    PM / devfreq: Fix devfreq_notifier_call returning errno
    
    [ Upstream commit e876e710ede23f670494331e062d643928e4142a ]
    
    Notifier callbacks shouldn't return negative errno but one of the
    NOTIFY_OK/DONE/BAD values.
    
    The OPP core will ignore return values from notifiers but returning a
    value that matches NOTIFY_STOP_MASK will stop the notification chain.
    
    Fix by always returning NOTIFY_OK.
    
    Signed-off-by: Leonard Crestez <leonard.crestez@xxxxxxx>
    Reviewed-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
    Reviewed-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
    Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 3a1484e7a3ae..e5c2afdc7b7f 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -551,26 +551,28 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type,
 				 void *devp)
 {
 	struct devfreq *devfreq = container_of(nb, struct devfreq, nb);
-	int ret;
+	int err = -EINVAL;
 
 	mutex_lock(&devfreq->lock);
 
 	devfreq->scaling_min_freq = find_available_min_freq(devfreq);
-	if (!devfreq->scaling_min_freq) {
-		mutex_unlock(&devfreq->lock);
-		return -EINVAL;
-	}
+	if (!devfreq->scaling_min_freq)
+		goto out;
 
 	devfreq->scaling_max_freq = find_available_max_freq(devfreq);
-	if (!devfreq->scaling_max_freq) {
-		mutex_unlock(&devfreq->lock);
-		return -EINVAL;
-	}
+	if (!devfreq->scaling_max_freq)
+		goto out;
+
+	err = update_devfreq(devfreq);
 
-	ret = update_devfreq(devfreq);
+out:
 	mutex_unlock(&devfreq->lock);
+	if (err)
+		dev_err(devfreq->dev.parent,
+			"failed to update frequency from OPP notifier (%d)\n",
+			err);
 
-	return ret;
+	return NOTIFY_OK;
 }
 
 /**



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux