From 0986b5aa92e48560b76c467c69abe258171ddd63 Mon Sep 17 00:00:00 2001 From: Thomas Ingleby Date: Wed, 7 May 2014 16:07:58 +0100 Subject: [PATCH] pinmap: test mode, add uninitialised protection. Signed-off-by: Thomas Ingleby Signed-off-by: Brendan Le Foll --- src/maa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/maa.c b/src/maa.c index a2a3bc8..631724e 100644 --- a/src/maa.c +++ b/src/maa.c @@ -220,6 +220,11 @@ maa_result_print(maa_result_t result) maa_boolean_t maa_pin_mode_test(int pin, maa_pinmodes_t mode) { + if (plat == NULL) { + maa_init(); + if (plat == NULL) + return 0; + } if (pin > plat->phy_pin_count || pin < 0) return 0;