Patch "cpufreq: exit() callback is optional" has been added to the 6.6-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

    cpufreq: exit() callback is optional

to the 6.6-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:
     cpufreq-exit-callback-is-optional.patch
and it can be found in the queue-6.6 subdirectory.

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



commit ccf589c479fe2963ee00e4707264ce46ac3522d5
Author: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Date:   Fri Apr 12 11:19:20 2024 +0530

    cpufreq: exit() callback is optional
    
    [ Upstream commit b8f85833c05730d631576008daaa34096bc7f3ce ]
    
    The exit() callback is optional and shouldn't be called without checking
    a valid pointer first.
    
    Also, we must clear freq_table pointer even if the exit() callback isn't
    present.
    
    Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
    Fixes: 91a12e91dc39 ("cpufreq: Allow light-weight tear down and bring up of CPUs")
    Fixes: f339f3541701 ("cpufreq: Rearrange locking in cpufreq_remove_dev()")
    Reported-by: Lizhe <sensor1010@xxxxxxx>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9177265d73b47..06e0294a17a8d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1670,10 +1670,13 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
 	 */
 	if (cpufreq_driver->offline) {
 		cpufreq_driver->offline(policy);
-	} else if (cpufreq_driver->exit) {
-		cpufreq_driver->exit(policy);
-		policy->freq_table = NULL;
+		return;
 	}
+
+	if (cpufreq_driver->exit)
+		cpufreq_driver->exit(policy);
+
+	policy->freq_table = NULL;
 }
 
 static int cpufreq_offline(unsigned int cpu)
@@ -1731,7 +1734,7 @@ static void cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif)
 	}
 
 	/* We did light-weight exit earlier, do full tear down now */
-	if (cpufreq_driver->offline)
+	if (cpufreq_driver->offline && cpufreq_driver->exit)
 		cpufreq_driver->exit(policy);
 
 	up_write(&policy->rwsem);




[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