aboutsummaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorLina Iyer <lina.iyer@linaro.org>2017-03-03 12:41:27 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-03-29 23:17:56 +0200
commitb539cc82d493d100606213df459c86e94f342996 (patch)
tree80f71d2c68a74f6fa1c32226367354645ba60453 /drivers/base
parent075c37d59ecd4a8b7c9cb5570e90d5b538797ad2 (diff)
PM / Domains: Ignore domain-idle-states that are not compatible
domain-idle-states property may have phandles to idle state bindings that may not be compatible with idle state definition defined in [1]. Such phandles would just be ignored and not throw and error when read by the domain core. Signed-off-by: Lina Iyer <lina.iyer@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/domain.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 06807933a285..ad196427b4f2 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2093,11 +2093,6 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state,
int err;
u32 residency;
u32 entry_latency, exit_latency;
- const struct of_device_id *match_id;
-
- match_id = of_match_node(idle_state_match, state_node);
- if (!match_id)
- return -EINVAL;
err = of_property_read_u32(state_node, "entry-latency-us",
&entry_latency);
@@ -2146,6 +2141,7 @@ int of_genpd_parse_idle_states(struct device_node *dn,
int err, ret;
int count;
struct of_phandle_iterator it;
+ const struct of_device_id *match_id;
count = of_count_phandle_with_args(dn, "domain-idle-states", NULL);
if (count <= 0)
@@ -2158,6 +2154,9 @@ int of_genpd_parse_idle_states(struct device_node *dn,
/* Loop over the phandles until all the requested entry is found */
of_for_each_phandle(&it, err, dn, "domain-idle-states", NULL, 0) {
np = it.node;
+ match_id = of_match_node(idle_state_match, np);
+ if (!match_id)
+ continue;
ret = genpd_parse_state(&st[i++], np);
if (ret) {
pr_err
@@ -2169,8 +2168,11 @@ int of_genpd_parse_idle_states(struct device_node *dn,
}
}
- *n = count;
- *states = st;
+ *n = i;
+ if (!i)
+ kfree(st);
+ else
+ *states = st;
return 0;
}