[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <c0d64cb031c21f163a0ec15cf10844bcf0ceedcf.1275026041.git.len.brown@intel.com>
Date: Fri, 28 May 2010 02:01:55 -0400
From: Len Brown <lenb@...nel.org>
To: linux-pm@...ts.linux-foundation.org
Cc: linux-kernel@...r.kernel.org, Len Brown <len.brown@...el.com>
Subject: [PATCH 2/8] cpuidle: add cpuidle_unregister_driver() error check
From: Len Brown <len.brown@...el.com>
Assure that cpuidle_unregister_driver() will not clobber
the registered driver if unregistered by somebody else.
Signed-off-by: Len Brown <len.brown@...el.com>
---
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 2257004..826b5c0 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -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;
--
1.6.0.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists