From 7f33127d925056d2fda90a5a7ffdf22aadc714c6 Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Thu, 12 Apr 2018 12:49:46 +0200
Subject: [PATCH] pkg/semtech-loramac: better handle radio init errors

---
 pkg/semtech-loramac/contrib/semtech_loramac_radio.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pkg/semtech-loramac/contrib/semtech_loramac_radio.c b/pkg/semtech-loramac/contrib/semtech_loramac_radio.c
index 8d2d8cb8e0..a81c1ad823 100644
--- a/pkg/semtech-loramac/contrib/semtech_loramac_radio.c
+++ b/pkg/semtech-loramac/contrib/semtech_loramac_radio.c
@@ -44,7 +44,11 @@ extern sx127x_t sx127x;
 void SX127XInit(RadioEvents_t *events)
 {
     (void) events;
-    sx127x_init(&sx127x);
+    if (sx127x_init(&sx127x) < 0) {
+        DEBUG("[semtech-loramac] radio: failed to initialize radio\n");
+    }
+
+    DEBUG("[semtech-loramac] radio: initialization successful\n");
 }
 
 RadioState_t SX127XGetStatus(void)
-- 
GitLab