diff options
author | Daniel Fu <danifu@nvidia.com> | 2013-08-16 10:28:03 +0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:41:33 -0700 |
commit | d875d559377240a8b03855ea509ccabc0285b62a (patch) | |
tree | d7e106ba302d6e8ac45a42d412d117ca55443b9b /drivers/cpuidle | |
parent | 565e45538106fd21ee166907ff68d0ad85ce2892 (diff) |
cpuidle: Check cpuidle driver before add refcount
If the current CPU has no cpuidle driver, drv will be NULL.
Check if we get drv successfully before add refount
to prevent Kernel panic.
Change-Id: I67d3e0b01ac7b177e8e281cdddf397a55e527b12
Signed-off-by: Daniel Fu <danifu@nvidia.com>
Reviewed-on: http://git-master/r/263252
Reviewed-by: Kerwin Wan <kerwinw@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r-- | drivers/cpuidle/driver.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 3ac499d5a207..6e11701f0fca 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -331,7 +331,8 @@ struct cpuidle_driver *cpuidle_driver_ref(void) spin_lock(&cpuidle_driver_lock); drv = cpuidle_get_driver(); - drv->refcnt++; + if (drv) + drv->refcnt++; spin_unlock(&cpuidle_driver_lock); return drv; |