summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShashi Shekar Shankar <ssbang@codeaurora.org>2018-03-27 13:41:06 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-04-19 02:54:46 -0700
commit98d3b2cf3b7544ab5bb7dfa36bed74e8d904e975 (patch)
tree2dbc4f5cc09f5408f4934dce909872a3b0365e5a
parent6d0d8f7af3358800936f4b950b59f2f128ed6dce (diff)
msm_performance: Add NULL pointer checks
Add NULL pointer checks. Change-Id: Ia49ed015e8ea13c63296c4491c9d3af99ef0e121 Signed-off-by: Shashi Shekar Shankar <ssbang@codeaurora.org>
-rw-r--r--drivers/soc/qcom/msm_performance.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/soc/qcom/msm_performance.c b/drivers/soc/qcom/msm_performance.c
index 1046af031838..1857d369bc94 100644
--- a/drivers/soc/qcom/msm_performance.c
+++ b/drivers/soc/qcom/msm_performance.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2379,6 +2379,7 @@ end:
static void __ref try_hotplug(struct cluster *data)
{
unsigned int i;
+ struct device *dev;
if (!clusters_inited)
return;
@@ -2405,7 +2406,8 @@ static void __ref try_hotplug(struct cluster *data)
pr_debug("msm_perf: Offlining CPU%d\n", i);
cpumask_set_cpu(i, data->offlined_cpus);
lock_device_hotplug();
- if (device_offline(get_cpu_device(i))) {
+ dev = get_cpu_device(i);
+ if (!dev || device_offline(dev)) {
cpumask_clear_cpu(i, data->offlined_cpus);
pr_debug("msm_perf: Offlining CPU%d failed\n",
i);
@@ -2423,7 +2425,8 @@ static void __ref try_hotplug(struct cluster *data)
continue;
pr_debug("msm_perf: Onlining CPU%d\n", i);
lock_device_hotplug();
- if (device_online(get_cpu_device(i))) {
+ dev = get_cpu_device(i);
+ if (!dev || device_online(dev)) {
pr_debug("msm_perf: Onlining CPU%d failed\n",
i);
unlock_device_hotplug();
@@ -2442,11 +2445,19 @@ static void __ref try_hotplug(struct cluster *data)
static void __ref release_cluster_control(struct cpumask *off_cpus)
{
int cpu;
+ struct device *dev;
for_each_cpu(cpu, off_cpus) {
pr_debug("msm_perf: Release CPU %d\n", cpu);
lock_device_hotplug();
- if (!device_online(get_cpu_device(cpu)))
+ dev = get_cpu_device(cpu);
+ if (!dev) {
+ pr_debug("msm_perf: Failed to get CPU%d\n",
+ cpu);
+ unlock_device_hotplug();
+ continue;
+ }
+ if (!device_online(dev))
cpumask_clear_cpu(cpu, off_cpus);
unlock_device_hotplug();
}