diff options
| author | Taniya Das <tdas@codeaurora.org> | 2016-02-09 11:27:33 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:22:10 -0700 |
| commit | 5bfe822bd0c35220abcbec23985d934e634f0816 (patch) | |
| tree | 2b4ed764823b8c55a042d7324b4290ba4f6df0f4 /drivers/cpuidle | |
| parent | 99d535fc95fad0128a1708f660264161e08b415d (diff) | |
cpuidle: lpm-levels: Fix NULL pointer exception at lpm_get_latency
In cases where client driver would call the API lpm_get_latency before the
lpm_root_node is initialized, would result in a NULL pointer exception. Fix
the same by moving the node check before.
CRs-Fixed: 973895
Change-Id: Ib2c7257bb7289f68d2bcb621ad311ceefe88a5f3
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Diffstat (limited to 'drivers/cpuidle')
| -rw-r--r-- | drivers/cpuidle/lpm-levels.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/cpuidle/lpm-levels.c b/drivers/cpuidle/lpm-levels.c index b0a9f8104c6c..78c48a0ebe59 100644 --- a/drivers/cpuidle/lpm-levels.c +++ b/drivers/cpuidle/lpm-levels.c @@ -239,6 +239,11 @@ int lpm_get_latency(struct latency_level *level, uint32_t *latency) struct lpm_cluster *cluster; uint32_t val; + if (!lpm_root_node) { + pr_err("%s: lpm_probe not completed\n", __func__); + return -EAGAIN; + } + if ((level->affinity_level < 0) || (level->affinity_level > lpm_root_node->aff_level) || (level->reset_level < LPM_RESET_LVL_RET) @@ -246,11 +251,6 @@ int lpm_get_latency(struct latency_level *level, uint32_t *latency) || !latency) return -EINVAL; - if (!lpm_root_node) { - pr_err("%s: lpm_probe not completed\n", __func__); - return -EAGAIN; - } - cluster = cluster_aff_match(lpm_root_node, level->affinity_level); if (!cluster) { pr_err("%s:No matching cluster found for affinity_level:%d\n", |
