PM / Domains: check for negative return from of_count_phandle_with_args()
authorColin Ian King <colin.king@canonical.com>
Tue, 25 Oct 2016 16:33:27 +0000 (17:33 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 27 Oct 2016 11:00:32 +0000 (13:00 +0200)
commita1fee00dc95644e0590b4f1a3755c9f6b1243b3a
tree45cf5b081069f6cba6cde94dac3500face44b25e
parent411bf2a8db76d7ed6f710df77121e5113ee8fe64
PM / Domains: check for negative return from of_count_phandle_with_args()

The return from of_count_phandle_with_args can be negative, so we
should avoid kcalloc of a negative count of genpd_power_stat structs
by sanity checking if count is zero or less.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/domain.c