mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08: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
220af9d013
commit
ebced8158b
@ -1234,7 +1234,8 @@ static void cluster_prepare(struct lpm_cluster *cluster,
|
|||||||
if (cluster_configure(cluster, i, from_idle, predicted))
|
if (cluster_configure(cluster, i, from_idle, predicted))
|
||||||
goto failed;
|
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,
|
cluster_prepare(cluster->parent, &cluster->num_children_in_sync, i,
|
||||||
from_idle, start_time);
|
from_idle, start_time);
|
||||||
|
|
||||||
@ -1242,7 +1243,8 @@ static void cluster_prepare(struct lpm_cluster *cluster,
|
|||||||
return;
|
return;
|
||||||
failed:
|
failed:
|
||||||
spin_unlock(&cluster->sync_lock);
|
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,
|
static void cluster_unprepare(struct lpm_cluster *cluster,
|
||||||
@ -1281,7 +1283,7 @@ static void cluster_unprepare(struct lpm_cluster *cluster,
|
|||||||
if (!first_cpu || cluster->last_level == cluster->default_level)
|
if (!first_cpu || cluster->last_level == cluster->default_level)
|
||||||
goto unlock_return;
|
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 = end_time -
|
||||||
cluster->stats->sleep_time;
|
cluster->stats->sleep_time;
|
||||||
lpm_stats_cluster_exit(cluster->stats, cluster->last_level, success);
|
lpm_stats_cluster_exit(cluster->stats, cluster->last_level, success);
|
||||||
@ -1723,6 +1725,9 @@ static void register_cluster_lpm_stats(struct lpm_cluster *cl,
|
|||||||
|
|
||||||
cl->stats = lpm_stats_config_level(cl->cluster_name, level_name,
|
cl->stats = lpm_stats_config_level(cl->cluster_name, level_name,
|
||||||
cl->nlevels, parent ? parent->stats : NULL, NULL);
|
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);
|
kfree(level_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user