From: Tomeu Vizoso Date: Thu, 15 Sep 2016 12:05:23 +0000 (+0200) Subject: PM / Domains: Allow holes in genpd_data.domains array X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=609bed67bd8f72981faba75d80b3b48d746b7206;p=linux-beck.git PM / Domains: Allow holes in genpd_data.domains array In platforms such as Rockchip's, the array of domains isn't always filled without holes, as which domains are present depend on the particular SoC revision. By allowing holes to be in the array, such SoCs can still use a single set of constants to index the array of power domains. Fixes: 0159ec670763 (PM / Domains: Verify the PM domain is present when adding a provider) Signed-off-by: Tomeu Vizoso Acked-by: Jon Hunter Acked-by: Ulf Hansson Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Acked-by: Kevin Hilman Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index b0cf46dcae73..83ae3d7d3fdd 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1581,6 +1581,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, mutex_lock(&gpd_list_lock); for (i = 0; i < data->num_domains; i++) { + if (!data->domains[i]) + continue; if (!pm_genpd_present(data->domains[i])) goto error; @@ -1598,6 +1600,8 @@ int of_genpd_add_provider_onecell(struct device_node *np, error: while (i--) { + if (!data->domains[i]) + continue; data->domains[i]->provider = NULL; data->domains[i]->has_provider = false; }