summaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/dt_idle_states.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/dt_idle_states.c')
-rw-r--r--drivers/cpuidle/dt_idle_states.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index 252f2a9686a6..7ca3d7d9b5ea 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -211,18 +211,15 @@ int dt_init_idle_driver(struct cpuidle_driver *drv,
of_node_put(cpu_node);
if (err)
return err;
- /*
- * Update the driver state count only if some valid DT idle states
- * were detected
- */
- if (i)
- drv->state_count = state_idx;
+
+ /* Set the number of total supported idle states. */
+ drv->state_count = state_idx;
/*
* Return the number of present and valid DT idle states, which can
* also be 0 on platforms with missing DT idle states or legacy DT
* configuration predating the DT idle states bindings.
*/
- return i;
+ return state_idx - start_idx;
}
EXPORT_SYMBOL_GPL(dt_init_idle_driver);