diff options
author | Len Brown <len.brown@intel.com> | 2010-05-22 16:34:10 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-05-27 13:04:04 -0400 |
commit | c0d64cb031c21f163a0ec15cf10844bcf0ceedcf (patch) | |
tree | ce65dc6b8cbda91e8c1f1c69753265618e8d9ae6 /drivers/cpuidle/driver.c | |
parent | 6b2c676bf32be91f43215d5874c07c1becaba013 (diff) |
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>
Diffstat (limited to 'drivers/cpuidle/driver.c')
-rw-r--r-- | drivers/cpuidle/driver.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 2257004fe33d..826b5c0aa12b 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c | |||
@@ -45,8 +45,11 @@ EXPORT_SYMBOL_GPL(cpuidle_register_driver); | |||
45 | */ | 45 | */ |
46 | void cpuidle_unregister_driver(struct cpuidle_driver *drv) | 46 | void cpuidle_unregister_driver(struct cpuidle_driver *drv) |
47 | { | 47 | { |
48 | if (!drv) | 48 | if (drv != cpuidle_curr_driver) { |
49 | WARN(1, "invalid cpuidle_unregister_driver(%s)\n", | ||
50 | drv->name); | ||
49 | return; | 51 | return; |
52 | } | ||
50 | 53 | ||
51 | spin_lock(&cpuidle_driver_lock); | 54 | spin_lock(&cpuidle_driver_lock); |
52 | cpuidle_curr_driver = NULL; | 55 | cpuidle_curr_driver = NULL; |