mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-08-18 02:22:47 -07:00
cpuidle: add cpuidle_unregister_driver() error check
Assure that cpuidle_unregister_driver() will not clobber the registered driver if unregistered by somebody else. Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
1 parent
6b2c676bf3
commit
c0d64cb031
1 file changed
+4
-1
@@ -45,8 +45,11 @@ EXPORT_SYMBOL_GPL(cpuidle_register_driver);
|
||||
*/
|
||||
void cpuidle_unregister_driver(struct cpuidle_driver *drv)
|
||||
{
|
||||
if (!drv)
|
||||
if (drv != cpuidle_curr_driver) {
|
||||
WARN(1, "invalid cpuidle_unregister_driver(%s)\n",
|
||||
drv->name);
|
||||
return;
|
||||
}
|
||||
|
||||
spin_lock(&cpuidle_driver_lock);
|
||||
cpuidle_curr_driver = NULL;
|
||||
|
||||
Reference in new issue
Block a user