Patch "PM / devfreq: Don't fail devfreq_dev_release if not in list" has been added to the 4.19-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: Don't fail devfreq_dev_release if not in list

to the 4.19-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-don-t-fail-devfreq_dev_release-if-not-in-.patch
and it can be found in the queue-4.19 subdirectory.

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



commit 6f80a66835fc2c5200ba315a0718810131896e81
Author: Leonard Crestez <leonard.crestez@xxxxxxx>
Date:   Thu Nov 14 01:21:31 2019 +0200

    PM / devfreq: Don't fail devfreq_dev_release if not in list
    
    [ Upstream commit 42a6b25e67df6ee6675e8d1eaf18065bd73328ba ]
    
    Right now devfreq_dev_release will print a warning and abort the rest of
    the cleanup if the devfreq instance is not part of the global
    devfreq_list. But this is a valid scenario, for example it can happen if
    the governor can't be found or on any other init error that happens
    after device_register.
    
    Initialize devfreq->node to an empty list head in devfreq_add_device so
    that list_del becomes a safe noop inside devfreq_dev_release and we can
    continue the rest of the cleanup.
    
    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 a47e76a62287..69bbb1e9ab23 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -575,11 +575,6 @@ static void devfreq_dev_release(struct device *dev)
 	struct devfreq *devfreq = to_devfreq(dev);
 
 	mutex_lock(&devfreq_list_lock);
-	if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) {
-		mutex_unlock(&devfreq_list_lock);
-		dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n");
-		return;
-	}
 	list_del(&devfreq->node);
 	mutex_unlock(&devfreq_list_lock);
 
@@ -634,6 +629,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
 	devfreq->dev.parent = dev;
 	devfreq->dev.class = devfreq_class;
 	devfreq->dev.release = devfreq_dev_release;
+	INIT_LIST_HEAD(&devfreq->node);
 	devfreq->profile = profile;
 	strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN);
 	devfreq->previous_freq = profile->initial_freq;



[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