Skip to content

Commit

Permalink
ARM: EXYNOS: Fix dereference of ERR_PTR returned by of_genpd_get_from…
Browse files Browse the repository at this point in the history
…_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: 0f78075 ("ARM: EXYNOS: add support for sub-power domains")
Cc: <stable@vger.kernel.org>	[4.0+]
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene@kernel.org>
  • Loading branch information
Krzysztof Kozlowski authored and Kukjin Kim committed May 13, 2015
1 parent e5cbec6 commit 0b7dc0f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm/mach-exynos/pm_domains.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ static __init int exynos4_pm_init_power_domain(void)
args.np = np;
args.args_count = 0;
child_domain = of_genpd_get_from_provider(&args);
if (!child_domain)
if (IS_ERR(child_domain))
continue;

if (of_parse_phandle_with_args(np, "power-domains",
"#power-domain-cells", 0, &args) != 0)
continue;

parent_domain = of_genpd_get_from_provider(&args);
if (!parent_domain)
if (IS_ERR(parent_domain))
continue;

if (pm_genpd_add_subdomain(parent_domain, child_domain))
Expand Down

0 comments on commit 0b7dc0f

Please sign in to comment.