cederom commented on code in PR #15820:
URL: https://github.com/apache/nuttx/pull/15820#discussion_r1953538035


##########
arch/risc-v/src/mpfs/mpfs_irq.c:
##########
@@ -125,9 +125,7 @@ void up_disable_irq(int irq)
           PANIC();
         }
 
-      /* Disable the irq on all harts, we don't know on which it was
-       * enabled
-       */
+      /* Disable the irq on all harts */

Review Comment:
   we may leave this comment as it explains why all irqs are disabled :-)



##########
arch/risc-v/src/mpfs/mpfs_irq.c:
##########
@@ -173,19 +172,21 @@ void up_enable_irq(int irq)
   else if (irq >= MPFS_IRQ_EXT_START)
     {
       extirq = irq - MPFS_IRQ_EXT_START;
+      if (extirq < 0 || extirq > NR_IRQS - MPFS_IRQ_EXT_START)

Review Comment:
   good check :-)



##########
arch/risc-v/src/mpfs/mpfs_irq.c:
##########
@@ -173,19 +172,21 @@ void up_enable_irq(int irq)
   else if (irq >= MPFS_IRQ_EXT_START)
     {
       extirq = irq - MPFS_IRQ_EXT_START;
+      if (extirq < 0 || extirq > NR_IRQS - MPFS_IRQ_EXT_START)
+        {
+          PANIC();
+        }
 
-      /* Set enable bit for the irq */
-
-      uintptr_t iebase = mpfs_plic_get_iebase(up_cpu_index());
+      /* Enable the irq on all harts */
 
-      if (0 <= extirq && extirq <= NR_IRQS - MPFS_IRQ_EXT_START)
+      for (i = 0; i < CONFIG_SMP_NCPUS; i++)

Review Comment:
   okay and complementary disable irq on all harts is on line 128?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to