summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-01 16:32:41 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-01 16:43:35 +0200
commit52fb74ca651be4dceeb0f65274cd2ee1047b5204 (patch)
tree901fb2c8255007ad0959fa23c63323321bdde0b3
parent737e18dbca03c086601dfbe7f90ae143bc34f964 (diff)
downloadrtems-52fb74ca651be4dceeb0f65274cd2ee1047b5204.tar.bz2
bsp/leon3: Fix bsp_interrupt_is_valid_vector()
The fix to address CID 1399742 (NO_EFFECT) in commit f8b6359415404540864f809cbcffb8c2200261e1 introduced a bug since LEON3_IrqCtrl_EIrq == -1 in case no extended interrupts are supported by the interrupt controller. Fix this by checking for LEON3_IrqCtrl_EIrq > 0. In addition, interrupt number 0 is reserved and should not be used.
-rw-r--r--bsps/sparc/leon3/include/bsp/irq.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/bsps/sparc/leon3/include/bsp/irq.h b/bsps/sparc/leon3/include/bsp/irq.h
index bc1b5775e7..45d5a8de34 100644
--- a/bsps/sparc/leon3/include/bsp/irq.h
+++ b/bsps/sparc/leon3/include/bsp/irq.h
@@ -34,11 +34,15 @@
*/
static inline bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
{
- if (LEON3_IrqCtrl_EIrq != 0) {
+ if (vector == 0) {
+ return false;
+ }
+
+ if (LEON3_IrqCtrl_EIrq > 0) {
return vector <= BSP_INTERRUPT_VECTOR_MAX_EXT;
- } else {
- return vector <= BSP_INTERRUPT_VECTOR_MAX_STD;
}
+
+ return vector <= BSP_INTERRUPT_VECTOR_MAX_STD;
}
void bsp_interrupt_set_affinity(