mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 20:59:02 +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> |
||
|---|---|---|
| .. | ||
| android | ||
| arpa | ||
| crypto | ||
| cxx | ||
| net | ||
| netinet | ||
| netpacket | ||
| nuttx | ||
| ssp | ||
| sys | ||
| .gitignore | ||
| aio.h | ||
| alloca.h | ||
| assert.h | ||
| byteswap.h | ||
| ctype.h | ||
| debug.h | ||
| dirent.h | ||
| dlfcn.h | ||
| dsp.h | ||
| dspb16.h | ||
| elf.h | ||
| elf32.h | ||
| elf64.h | ||
| endian.h | ||
| err.h | ||
| errno.h | ||
| execinfo.h | ||
| fcntl.h | ||
| fixedmath.h | ||
| fnmatch.h | ||
| ftw.h | ||
| gcov.h | ||
| getopt.h | ||
| glob.h | ||
| grp.h | ||
| hex2bin.h | ||
| iconv.h | ||
| ifaddrs.h | ||
| imx_container.h | ||
| inttypes.h | ||
| iso646.h | ||
| langinfo.h | ||
| libgen.h | ||
| libintl.h | ||
| limits.h | ||
| locale.h | ||
| lzf.h | ||
| malloc.h | ||
| mqueue.h | ||
| netdb.h | ||
| nl_types.h | ||
| nxflat.h | ||
| obstack.h | ||
| poll.h | ||
| pthread.h | ||
| pty.h | ||
| pwd.h | ||
| regex.h | ||
| resolv.h | ||
| sched.h | ||
| search.h | ||
| semaphore.h | ||
| shadow.h | ||
| signal.h | ||
| spawn.h | ||
| stdbool.h | ||
| stddef.h | ||
| stdint.h | ||
| stdio.h | ||
| stdlib.h | ||
| stdnoreturn.h | ||
| string.h | ||
| strings.h | ||
| syscall.h | ||
| syslog.h | ||
| termios.h | ||
| threads.h | ||
| time.h | ||
| ulimit.h | ||
| unistd.h | ||
| utime.h | ||
| uuid.h | ||
| wait.h | ||
| wchar.h | ||
| wctype.h | ||