mirror of
https://github.com/apache/nuttx.git
synced 2026-08-09 14:35:08 +00:00
Previously, IRQ bounds checking (irq >= 0 && irq < NR_IRQS) was duplicated across multiple IRQ subsystem functions before calling IRQ_TO_NDX(). This led to code duplication and inconsistency. This patch consolidates all IRQ bounds checking into the IRQ_TO_NDX() macro itself, which now returns -EINVAL for out-of-bounds IRQ numbers. This approach: 1. Eliminates duplicated bounds checking code 2. Ensures consistent error handling across all IRQ functions 3. Simplifies caller code - just check if IRQ_TO_NDX() returns negative 4. Makes the macro behavior more predictable and self-contained Changes: - Modified IRQ_TO_NDX() to check (irq < 0 || irq >= NR_IRQS) and return -EINVAL - Removed redundant IRQ range checks in irq_attach(), irq_attach_thread(), irq_attach_wqueue(), and irqchain_detach() - Simplified error handling to check ndx < 0 after IRQ_TO_NDX() call This consolidation reduces code size and improves maintainability while preserving all existing error checking functionality. Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com> |
||
|---|---|---|
| .. | ||
| addrenv | ||
| clock | ||
| environ | ||
| event | ||
| group | ||
| hrtimer | ||
| init | ||
| instrument | ||
| irq | ||
| misc | ||
| module | ||
| mqueue | ||
| paging | ||
| pthread | ||
| sched | ||
| semaphore | ||
| signal | ||
| task | ||
| timer | ||
| tls | ||
| wdog | ||
| wqueue | ||
| CMakeLists.txt | ||
| Kconfig | ||
| Makefile | ||