From 48fabca38dbb08d4e73d337c8ee9f058baf41ca2 Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Thu, 25 Apr 2019 12:14:18 +0200 Subject: [PATCH] cpu/atmega_common: Fix return value of irq_enable Citing the doc of irq_enable(): @return Previous value of status register. [...] On atmega however the new value of the status register is returned, not the one prior to enabling interrupts. --- cpu/atmega_common/irq_arch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpu/atmega_common/irq_arch.c b/cpu/atmega_common/irq_arch.c index da16ec384d..771335b9ef 100644 --- a/cpu/atmega_common/irq_arch.c +++ b/cpu/atmega_common/irq_arch.c @@ -70,8 +70,9 @@ unsigned int irq_disable(void) */ unsigned int irq_enable(void) { + uint8_t mask = __get_interrupt_state(); sei(); - return __get_interrupt_state(); + return mask; } /**