From: Geert Uytterhoeven Date: Wed, 18 Apr 2018 14:50:04 +0000 (+0200) Subject: soc/tegra: pmc: Use of_clk_get_parent_count() instead of open coding X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3fd0121b0242dacc020046dade5a0362b6522c5b;p=linux.git 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 Acked-by: Jon Hunter Reviewed-by: Daniel Lezcano Signed-off-by: Stephen Boyd --- diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index d9fcdb592b396..d8cb48a4b8eb1 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -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;