diff options
author | Colin Ian King <colin.king@canonical.com> | 2016-04-16 13:50:03 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-04-26 21:11:35 +0200 |
commit | 0b26985a7d76645598d98fec6922ddd1ec8cbc55 (patch) | |
tree | 9fdfa733c6d65517effd170a645349a8f5f52221 /drivers/base/power/clock_ops.c | |
parent | 02da2d72174c61988eb4456b53f405e3ebdebce4 (diff) |
PM / clk: ensure we don't allocate a -ve size of count clks
It is entirely possible for of_count_phandle_wit_args to
return a -ve error return value so we need to check for this
otherwise we end up allocating a negative number of clk objects.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power/clock_ops.c')
-rw-r--r-- | drivers/base/power/clock_ops.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c index 0e64a1b5e62a..3657ac1cb801 100644 --- a/drivers/base/power/clock_ops.c +++ b/drivers/base/power/clock_ops.c @@ -159,7 +159,7 @@ int of_pm_clk_add_clks(struct device *dev) count = of_count_phandle_with_args(dev->of_node, "clocks", "#clock-cells"); - if (count == 0) + if (count <= 0) return -ENODEV; clks = kcalloc(count, sizeof(*clks), GFP_KERNEL); |