msm_performance: Add NULL pointer checks
Add NULL pointer checks. Change-Id: Ia49ed015e8ea13c63296c4491c9d3af99ef0e121 Signed-off-by: Shashi Shekar Shankar <ssbang@codeaurora.org>
This commit is contained in:
parent
6d0d8f7af3
commit
98d3b2cf3b
1 changed files with 15 additions and 4 deletions
|
@ -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
|
* 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
|
* 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)
|
static void __ref try_hotplug(struct cluster *data)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
struct device *dev;
|
||||||
|
|
||||||
if (!clusters_inited)
|
if (!clusters_inited)
|
||||||
return;
|
return;
|
||||||
|
@ -2405,7 +2406,8 @@ static void __ref try_hotplug(struct cluster *data)
|
||||||
pr_debug("msm_perf: Offlining CPU%d\n", i);
|
pr_debug("msm_perf: Offlining CPU%d\n", i);
|
||||||
cpumask_set_cpu(i, data->offlined_cpus);
|
cpumask_set_cpu(i, data->offlined_cpus);
|
||||||
lock_device_hotplug();
|
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);
|
cpumask_clear_cpu(i, data->offlined_cpus);
|
||||||
pr_debug("msm_perf: Offlining CPU%d failed\n",
|
pr_debug("msm_perf: Offlining CPU%d failed\n",
|
||||||
i);
|
i);
|
||||||
|
@ -2423,7 +2425,8 @@ static void __ref try_hotplug(struct cluster *data)
|
||||||
continue;
|
continue;
|
||||||
pr_debug("msm_perf: Onlining CPU%d\n", i);
|
pr_debug("msm_perf: Onlining CPU%d\n", i);
|
||||||
lock_device_hotplug();
|
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",
|
pr_debug("msm_perf: Onlining CPU%d failed\n",
|
||||||
i);
|
i);
|
||||||
unlock_device_hotplug();
|
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)
|
static void __ref release_cluster_control(struct cpumask *off_cpus)
|
||||||
{
|
{
|
||||||
int cpu;
|
int cpu;
|
||||||
|
struct device *dev;
|
||||||
|
|
||||||
for_each_cpu(cpu, off_cpus) {
|
for_each_cpu(cpu, off_cpus) {
|
||||||
pr_debug("msm_perf: Release CPU %d\n", cpu);
|
pr_debug("msm_perf: Release CPU %d\n", cpu);
|
||||||
lock_device_hotplug();
|
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);
|
cpumask_clear_cpu(cpu, off_cpus);
|
||||||
unlock_device_hotplug();
|
unlock_device_hotplug();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue