[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1377863302-22465-1-git-send-email-danifu@nvidia.com>
Date: Fri, 30 Aug 2013 19:48:22 +0800
From: Daniel Fu <danifu@...dia.com>
To: <rjw@...k.pl>, <daniel.lezcano@...aro.org>
CC: <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<joqiu@...dia.com>, Daniel Fu <danifu@...dia.com>
Subject: [PATCH] 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.
Signed-off-by: Daniel Fu <danifu@...dia.com>
---
drivers/cpuidle/driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 3ac499d..6e11701 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;
--
1.8.1.5
--
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