From 892268d74b3ed2856320bcd39e172bdcebb504c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Roussel?= <Kevin.Roussel@inria.fr>
Date: Thu, 19 Jun 2014 15:03:48 +0200
Subject: [PATCH] Ensure only GIE bit is touched in splx_()

---
 cpu/msp430-common/lpm_cpu.c     | 2 +-
 cpu/msp430-common/msp430-main.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpu/msp430-common/lpm_cpu.c b/cpu/msp430-common/lpm_cpu.c
index 96fa00e692..e7893bb0ac 100644
--- a/cpu/msp430-common/lpm_cpu.c
+++ b/cpu/msp430-common/lpm_cpu.c
@@ -82,7 +82,7 @@ enum lpm_mode lpm_set(enum lpm_mode target)
     case LPM_OFF:
         /* MCU totally down (LPM4), only RESET or NMI can resume execution */
         __bis_status_register(CPUOFF | OSCOFF | SCG0 | SCG1);
-                              /* all blocks off */
+                               /* all blocks off */
         break;
     default:
         printf("ERROR: trying to set an invalid low-power mode!\n");
diff --git a/cpu/msp430-common/msp430-main.c b/cpu/msp430-common/msp430-main.c
index 50dcbd1985..6a908f2a49 100644
--- a/cpu/msp430-common/msp430-main.c
+++ b/cpu/msp430-common/msp430-main.c
@@ -170,6 +170,7 @@ splhigh_(void)
 void
 splx_(int sr)
 {
+    sr &= GIE;
     /* If GIE was set, restore it. */
     asmv("bis %0, r2" : : "r"(sr));
     asmv("nop");
-- 
GitLab