Commit 0b7dc0ff authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Kukjin Kim

ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from_provider

ERR_PTR was dereferenced during sub domain parsing, if parent domain
could not be obtained (because of invalid phandle or deferred
registration of parent domain).

The Exynos power domain code checked whether
of_genpd_get_from_provider() returned NULL and in that case it skipped
that power domain node. However this function returns ERR_PTR or valid
pointer, not NULL.

Fixes: 0f780751 ("ARM: EXYNOS: add support for sub-power domains")
Cc: <stable@vger.kernel.org>	[4.0+]
Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: default avatarKukjin Kim <kgene@kernel.org>
parent e5cbec61
...@@ -188,7 +188,7 @@ static __init int exynos4_pm_init_power_domain(void) ...@@ -188,7 +188,7 @@ static __init int exynos4_pm_init_power_domain(void)
args.np = np; args.np = np;
args.args_count = 0; args.args_count = 0;
child_domain = of_genpd_get_from_provider(&args); child_domain = of_genpd_get_from_provider(&args);
if (!child_domain) if (IS_ERR(child_domain))
continue; continue;
if (of_parse_phandle_with_args(np, "power-domains", if (of_parse_phandle_with_args(np, "power-domains",
...@@ -196,7 +196,7 @@ static __init int exynos4_pm_init_power_domain(void) ...@@ -196,7 +196,7 @@ static __init int exynos4_pm_init_power_domain(void)
continue; continue;
parent_domain = of_genpd_get_from_provider(&args); parent_domain = of_genpd_get_from_provider(&args);
if (!parent_domain) if (IS_ERR(parent_domain))
continue; continue;
if (pm_genpd_add_subdomain(parent_domain, child_domain)) if (pm_genpd_add_subdomain(parent_domain, child_domain))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment