From d04911d5695caeee2b403352dd9eb89447f590b1 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Thu, 11 Feb 2016 10:16:58 +0000 Subject: [PATCH] mraa.c: Fix mraa_init with usb subplatform This fix only affects USBPLAT=ON which would cause mraa_init to return uninitialised if we had detected a platform. Whilst the initialisation had actually been done correctly the results would be that platform_name was unfilled and no iio initialisation was done Signed-off-by: Brendan Le Foll --- src/mraa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mraa.c b/src/mraa.c index 082c12d..f3f131c 100644 --- a/src/mraa.c +++ b/src/mraa.c @@ -131,13 +131,13 @@ mraa_init() plat->platform_name = "Unknown platform"; } } - // Now detect sub platform + // Now detect sub platform, note this is not an else since we could be in + // an error case and fall through to MRAA_ERROR_PLATFORM_NOT_INITIALISED if (plat != NULL) { mraa_platform_t usb_platform_type = mraa_usb_platform_extender(plat); + // if we have no known platform just replace usb platform with platform if (plat->platform_type == MRAA_UNKNOWN_PLATFORM && usb_platform_type != MRAA_UNKNOWN_PLATFORM) { plat->platform_type = usb_platform_type; - } else { - return MRAA_ERROR_PLATFORM_NOT_INITIALISED; } } if (plat == NULL) {