diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2018-01-23 21:43:08 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-02-07 12:02:01 +0100 |
commit | a3381e3a65cbaf612c8f584906c4dba27e84267c (patch) | |
tree | 2fb763468bf084673a35b23fc00dc5e0d9f1b206 /arch | |
parent | 7f3fdd40a7dfaa7405185250974b0fabd08c1f8b (diff) | |
download | linux-a3381e3a65cbaf612c8f584906c4dba27e84267c.tar.bz2 |
PM / domains: Fix up domain-idle-states OF parsing
Commit b539cc82d493 (PM / Domains: Ignore domain-idle-states that are
not compatible), made it possible to ignore non-compatible
domain-idle-states OF nodes. However, in case that happens while doing
the OF parsing, the number of elements in the allocated array would
exceed the numbers actually needed, thus wasting memory.
Fix this by pre-iterating the genpd OF node and counting the number of
compatible domain-idle-states nodes, before doing the allocation. While
doing this, it makes sense to rework the code a bit to avoid open coding,
of parts responsible for the OF node iteration.
Let's also take the opportunity to clarify the function header for
of_genpd_parse_idle_states(), about what is being returned in case of
errors.
Fixes: b539cc82d493 (PM / Domains: Ignore domain-idle-states that are not compatible)
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch')
0 files changed, 0 insertions, 0 deletions