CHROMIUM: MALI: Clean up supply-names and make them optional

When the 'supply-names' property was added to mali it should have been
done in a way that mali would fallback to the old behavior of assuming
a single supply named 'mali'.  Doing so keeps old device trees
working.  Let's add that to the code.

At the same time, let's clean up a few other things:
1. The 'reg_names' in power_control_init() was allocated dynamically
   even though in every other place in the mali code we allocate
   arrays using a fixed sized constant.  Let's simplify our lives and
   use the constant too.
2. The power_control_init() function didn't really handle the fact
   that of_property_count_strings() could return an error.  It would
   effectively cast this negative value to be unsigned (AKA very big)
   and pass it to malloc.  Let's explicitly check for an error.
3. If we get errors reading 'supply-names' (other than -EINVAL which
   means that the property simply isn't there), let's print the error
   to the log and also pass it out of the function.

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

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

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