CHROMIUM: MALI: Don't silently trash memory if there are > 2 regulators

When support as added to the mali code to support more than one
regulator the code was dynamic in checking to see how many supplies
were present but still stored supplies in a fixed sized array in
several places.  Let's make it explicit that the hardcoded number used
to size the arrays is a maximum and also do bounds checking at init
time so we know we won't clobber memory.

See CL:1317240 for where the code was originally added.

BUG=chromium:941638
TEST=Boot up and use GPU on veyron

Change-Id: I581ed6cbc86c563f09d394bb1a8ecba00c0ddfb4
Fixes: d12dc1a83564 ("CHROMIUM: MALI: Add Mali platform specific source")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1539804
Reviewed-by: Dominik Behr <dbehr@chromium.org>
Reviewed-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
4 files changed