[rtems commit] bsps: Avoid malloc() in generic IRQ support

Sebastian Huber sebh at rtems.org
Tue Jun 5 07:13:01 UTC 2018


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jun  1 07:00:37 2018 +0200

bsps: Avoid malloc() in generic IRQ support

Use rtems_heap_allocate_aligned_with_boundary() instead of malloc() to
avoid a dependency on errno.

---

 bsps/shared/irq/irq-generic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bsps/shared/irq/irq-generic.c b/bsps/shared/irq/irq-generic.c
index 99033dc..ed77a78 100644
--- a/bsps/shared/irq/irq-generic.c
+++ b/bsps/shared/irq/irq-generic.c
@@ -9,7 +9,7 @@
 /*
  * Based on concepts of Pavel Pisa, Till Straumann and Eric Valette.
  *
- * Copyright (c) 2008, 2017 embedded brains GmbH.
+ * Copyright (c) 2008, 2018 embedded brains GmbH.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -30,6 +30,7 @@
 #include <rtems/score/apimutex.h>
 #include <rtems/score/processormask.h>
 #include <rtems/score/sysstate.h>
+#include <rtems/malloc.h>
 
 #ifdef BSP_INTERRUPT_USE_INDEX_TABLE
   bsp_interrupt_handler_index_type bsp_interrupt_handler_index_table
@@ -141,7 +142,7 @@ static bsp_interrupt_handler_entry *bsp_interrupt_allocate_handler_entry(void)
       return NULL;
     }
   #else
-    return malloc(sizeof(bsp_interrupt_handler_entry));
+    return rtems_heap_allocate_aligned_with_boundary(sizeof(bsp_interrupt_handler_entry), 0, 0);
   #endif
 }
 




More information about the vc mailing list