[2/4] cpuidle: psci: Fixup support for domain idle states being zero
diff mbox series

Message ID 20200227124551.31860-3-ulf.hansson@linaro.org
State New
Headers show
  • cpuidle: psci: Some fixes when using the hierarchical layout
Related show

Commit Message

Ulf Hansson Feb. 27, 2020, 12:45 p.m. UTC
The current code intends to allow a PSCI PM domain to have none domain idle
states defined in DT. However, a few minor things needs to be fixed to make
this correctly supported, so let's do that.

Reported-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
 drivers/cpuidle/cpuidle-psci-domain.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff mbox series

diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index 423f03bbeb74..c34b12c4069a 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -49,6 +49,9 @@  static int __init psci_pd_parse_state_nodes(struct genpd_power_state *states,
 	int i, ret;
 	u32 psci_state, *psci_state_buf;
+	if (!states)
+		return 0;
 	for (i = 0; i < state_count; i++) {
 		ret = psci_dt_parse_state_node(to_of_node(states[i].fwnode),
@@ -96,6 +99,9 @@  static void psci_pd_free_states(struct genpd_power_state *states,
 	int i;
+	if (!states)
+		return;
 	for (i = 0; i < state_count; i++)