From: Len Brown Date: Sat, 22 May 2010 20:34:10 +0000 (-0400) Subject: cpuidle: add cpuidle_unregister_driver() error check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c0d64cb031c21f163a0ec15cf10844bcf0ceedcf;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 --- diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 2257004fe33..826b5c0aa12 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;