aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorGravatar Geert Uytterhoeven <geert+renesas@glider.be> 2018-04-18 16:50:04 +0200
committerGravatar Stephen Boyd <sboyd@kernel.org> 2018-05-02 08:34:59 -0700
commit3fd0121b0242dacc020046dade5a0362b6522c5b (patch)
tree2aadf87eea009f673eed7cadf81d8368bfe1e81e /drivers
parentsoc: rockchip: power-domain: Use of_clk_get_parent_count() instead of open co... (diff)
downloadlinux-3fd0121b0242dacc020046dade5a0362b6522c5b.tar.gz
linux-3fd0121b0242dacc020046dade5a0362b6522c5b.tar.bz2
linux-3fd0121b0242dacc020046dade5a0362b6522c5b.zip
soc/tegra: pmc: 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 very big number in the allocation below. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/tegra/pmc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index d9fcdb592b39..d8cb48a4b8eb 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -31,6 +31,7 @@
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_clk.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
@@ -725,7 +726,7 @@ static int tegra_powergate_of_get_clks(struct tegra_powergate *pg,
unsigned int i, count;
int err;
- count = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+ count = of_clk_get_parent_count(np);
if (count == 0)
return -ENODEV;