[rtems commit] bsp/leon3: Simplify bsp_interrupt_is_valid_vector()

Sebastian Huber sebh at rtems.org
Thu Jan 28 10:13:18 UTC 2021


Module:    rtems
Branch:    master
Commit:    f8b6359415404540864f809cbcffb8c2200261e1
Changeset: http://git.rtems.org/rtems/commit/?id=f8b6359415404540864f809cbcffb8c2200261e1

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jan 28 10:31:07 2021 +0100

bsp/leon3: Simplify bsp_interrupt_is_valid_vector()

There is not need to check that vector >= BSP_INTERRUPT_VECTOR_MIN since
BSP_INTERRUPT_VECTOR_MIN is zero and vector is unsigned.

This fix relates to CID 1399742 (NO_EFFECT).

---

 bsps/sparc/leon3/include/bsp/irq.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/bsps/sparc/leon3/include/bsp/irq.h b/bsps/sparc/leon3/include/bsp/irq.h
index c3e7959..1c8e1e4 100644
--- a/bsps/sparc/leon3/include/bsp/irq.h
+++ b/bsps/sparc/leon3/include/bsp/irq.h
@@ -35,11 +35,11 @@
  */
 static inline bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
 {
-  return (rtems_vector_number) BSP_INTERRUPT_VECTOR_MIN <= vector
-    && ((vector <= (rtems_vector_number) BSP_INTERRUPT_VECTOR_MAX_STD &&
-        LEON3_IrqCtrl_EIrq == 0) ||
-       (vector <= (rtems_vector_number) BSP_INTERRUPT_VECTOR_MAX_EXT &&
-        LEON3_IrqCtrl_EIrq != 0));
+  if (LEON3_IrqCtrl_EIrq != 0) {
+    return vector <= BSP_INTERRUPT_VECTOR_MAX_EXT;
+  } else {
+    return vector <= BSP_INTERRUPT_VECTOR_MAX_STD;
+  }
 }
 
 void bsp_interrupt_set_affinity(



More information about the vc mailing list