diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-04-12 00:43:12 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-04-12 00:43:12 -0400 |
commit | ee1d13d27d6e6be7f9babce655f697fe7f224c77 (patch) | |
tree | ae4a706753869229808ae652f29dbada3012eb50 /libmaple | |
parent | 7b14b950363f707c40732b4387f2f50711907673 (diff) | |
download | librambutan-ee1d13d27d6e6be7f9babce655f697fe7f224c77.tar.gz librambutan-ee1d13d27d6e6be7f9babce655f697fe7f224c77.zip |
Adding guards for negative nvic_irq_num enumerators.
nvic_irq_enable() and nvic_irq_disable() previously didn't protect
against negative arguments.
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/nvic.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libmaple/nvic.h b/libmaple/nvic.h index 2e98c9f..496c41b 100644 --- a/libmaple/nvic.h +++ b/libmaple/nvic.h @@ -160,6 +160,9 @@ static inline void nvic_globalirq_disable() { * @param irq_num Interrupt to enable */ static inline void nvic_irq_enable(nvic_irq_num irq_num) { + if (irq_num < 0) { + return; + } NVIC_BASE->ISER[irq_num / 32] = BIT(irq_num % 32); } @@ -168,6 +171,9 @@ static inline void nvic_irq_enable(nvic_irq_num irq_num) { * @param irq_num Interrupt to disable */ static inline void nvic_irq_disable(nvic_irq_num irq_num) { + if (irq_num < 0) { + return; + } NVIC_BASE->ICER[irq_num / 32] = BIT(irq_num % 32); } |