[PATCH 02/41] bsps/irq: Canonicalize get/set affinity errors

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 12 12:49:24 UTC 2021


Bring the error conditions and status in line with
rtems_task_get_affinity() and rtems_task_set_affinity().

Update #3269.
---
 bsps/shared/irq/irq-affinity.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bsps/shared/irq/irq-affinity.c b/bsps/shared/irq/irq-affinity.c
index f750d6b174..d2214cf6ec 100644
--- a/bsps/shared/irq/irq-affinity.c
+++ b/bsps/shared/irq/irq-affinity.c
@@ -47,13 +47,17 @@ rtems_status_code rtems_interrupt_set_affinity(
   Processor_mask             set;
   Processor_mask_Copy_status status;
 
+  if ( affinity == NULL ) {
+    return RTEMS_INVALID_ADDRESS;
+  }
+
   if (!bsp_interrupt_is_valid_vector(vector)) {
     return RTEMS_INVALID_ID;
   }
 
   status = _Processor_mask_From_cpu_set_t(&set, affinity_size, affinity);
-  if (status != PROCESSOR_MASK_COPY_LOSSLESS) {
-    return RTEMS_INVALID_SIZE;
+  if ( !_Processor_mask_Is_at_most_partial_loss( status ) ) {
+    return RTEMS_INVALID_NUMBER;
   }
 
 #if defined(RTEMS_SMP)
@@ -71,6 +75,10 @@ rtems_status_code rtems_interrupt_get_affinity(
   Processor_mask             set;
   Processor_mask_Copy_status status;
 
+  if ( affinity == NULL ) {
+    return RTEMS_INVALID_ADDRESS;
+  }
+
   if (!bsp_interrupt_is_valid_vector(vector)) {
     return RTEMS_INVALID_ID;
   }
-- 
2.26.2



More information about the devel mailing list