mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
drivers: cpuidle: lpm-levels: check for valid LPM stats
When DEBUG_FS is not defined, the cluster->stats may be initialized to an error value. Check for valid stats pointer before updating the start and end times. Change-Id: I126766a017ebd9a84bd40f19ab3ff47877615429 Signed-off-by: Lina Iyer <ilina@codeaurora.org>
This commit is contained in:
parent
1c730ce06f
commit
dcc122e322
1 changed files with 8 additions and 3 deletions
|
|
@ -1019,7 +1019,8 @@ static void cluster_prepare(struct lpm_cluster *cluster,
|
|||
if (cluster_configure(cluster, i, from_idle, predicted))
|
||||
goto failed;
|
||||
|
||||
cluster->stats->sleep_time = start_time;
|
||||
if (!IS_ERR_OR_NULL(cluster->stats))
|
||||
cluster->stats->sleep_time = start_time;
|
||||
cluster_prepare(cluster->parent, &cluster->num_children_in_sync, i,
|
||||
from_idle, start_time);
|
||||
|
||||
|
|
@ -1027,7 +1028,8 @@ static void cluster_prepare(struct lpm_cluster *cluster,
|
|||
return;
|
||||
failed:
|
||||
spin_unlock(&cluster->sync_lock);
|
||||
cluster->stats->sleep_time = 0;
|
||||
if (!IS_ERR_OR_NULL(cluster->stats))
|
||||
cluster->stats->sleep_time = 0;
|
||||
}
|
||||
|
||||
static void cluster_unprepare(struct lpm_cluster *cluster,
|
||||
|
|
@ -1066,7 +1068,7 @@ static void cluster_unprepare(struct lpm_cluster *cluster,
|
|||
if (!first_cpu || cluster->last_level == cluster->default_level)
|
||||
goto unlock_return;
|
||||
|
||||
if (cluster->stats->sleep_time)
|
||||
if (!IS_ERR_OR_NULL(cluster->stats) && cluster->stats->sleep_time)
|
||||
cluster->stats->sleep_time = end_time -
|
||||
cluster->stats->sleep_time;
|
||||
lpm_stats_cluster_exit(cluster->stats, cluster->last_level, success);
|
||||
|
|
@ -1481,6 +1483,9 @@ static void register_cluster_lpm_stats(struct lpm_cluster *cl,
|
|||
|
||||
cl->stats = lpm_stats_config_level(cl->cluster_name, level_name,
|
||||
cl->nlevels, parent ? parent->stats : NULL, NULL);
|
||||
if (IS_ERR_OR_NULL(cl->stats))
|
||||
pr_info("Cluster (%s) stats not registered\n",
|
||||
cl->cluster_name);
|
||||
|
||||
kfree(level_name);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue