summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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();
}