summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2018-04-18 16:50:03 +0200
committerStephen Boyd <sboyd@kernel.org>2018-05-02 08:33:52 -0700
commit54d52ad940bb50284c85adcf481413fb3b82925a (patch)
tree6b17383d2ae12f4d9ed4f761abc02e45283baee5 /drivers/soc
parentb799cac753e3efa8c38e8e0061da36705aad1e27 (diff)
soc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open coding
As of_clk_get_parent_count() returns zero on failure, while of_count_phandle_with_args() might return a negative error code, this also fixes the issue of possibly using a negative number in the allocation below. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/rockchip/pm_domains.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 53efc386b1ad..13913d40c821 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -14,6 +14,7 @@
#include <linux/pm_clock.h>
#include <linux/pm_domain.h>
#include <linux/of_address.h>
+#include <linux/of_clk.h>
#include <linux/of_platform.h>
#include <linux/clk.h>
#include <linux/regmap.h>
@@ -400,8 +401,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
pd->info = pd_info;
pd->pmu = pmu;
- pd->num_clks = of_count_phandle_with_args(node, "clocks",
- "#clock-cells");
+ pd->num_clks = of_clk_get_parent_count(node);
if (pd->num_clks > 0) {
pd->clks = devm_kcalloc(pmu->dev, pd->num_clks,
sizeof(*pd->clks), GFP_KERNEL);