Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34a52920 authored by Taniya Das's avatar Taniya Das
Browse files

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: default avatarTaniya Das <tdas@codeaurora.org>
parent ac263d37
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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",