usb: USB sub-platform bug fixes.
authorHenry Bruce <henry.bruce@intel.com>
Thu, 23 Jul 2015 22:32:26 +0000 (15:32 -0700)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Tue, 8 Sep 2015 13:42:03 +0000 (14:42 +0100)
Signed-off-by: Henry Bruce <henry.bruce@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/mraa.c
src/usb/usb.c

index 837f753..03e9f46 100644 (file)
@@ -106,7 +106,8 @@ mraa_init()
     platform_type = mraa_x86_platform();
     // x86 platforms have advanced_func stable in board config structure
     free(advance_func);
-    advance_func = plat->adv_func;
+    if (plat != NULL)
+        advance_func = plat->adv_func;
 #elif defined(ARMPLAT)
     // Use runtime ARM platform detection
     platform_type = mraa_arm_platform();
index 96b9127..5154a3e 100644 (file)
@@ -55,8 +55,10 @@ mraa_usb_platform_extender(mraa_board_t* board)
             syslog(LOG_ERR, "Unknown USB Platform Extender, currently not supported by MRAA");
     }
 
-    sub_plat->platform_type = platform_type;
-    board->sub_platform = sub_plat;
+    if (sub_plat != NULL) {
+        sub_plat->platform_type = platform_type;
+        board->sub_platform = sub_plat;
+    }
     return platform_type;
 }