Module: xenomai-2.5
Branch: master
Commit: 6c7394d3ee68fdbc70f07b005b9f9dcc493c5a94
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=6c7394d3ee68fdbc70f07b005b9f9dcc493c5a94

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jan 11 16:51:48 2010 +0100

nios2: always check whether irq descriptors are present

---

 ksrc/arch/nios2/hal.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ksrc/arch/nios2/hal.c b/ksrc/arch/nios2/hal.c
index 27e18c0..fdee09a 100644
--- a/ksrc/arch/nios2/hal.c
+++ b/ksrc/arch/nios2/hal.c
@@ -96,7 +96,7 @@ unsigned long rthal_timer_calibrate(void)
 
 int rthal_irq_enable(unsigned irq)
 {
-       if (irq >= IPIPE_NR_XIRQS)
+       if (irq >= IPIPE_NR_XIRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        rthal_irq_desc_status(irq) &= ~IRQ_DISABLED;
@@ -107,7 +107,7 @@ int rthal_irq_enable(unsigned irq)
 int rthal_irq_disable(unsigned irq)
 {
 
-       if (irq >= IPIPE_NR_XIRQS)
+       if (irq >= IPIPE_NR_XIRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        rthal_irq_desc_status(irq) |= IRQ_DISABLED;
@@ -117,7 +117,7 @@ int rthal_irq_disable(unsigned irq)
 
 int rthal_irq_end(unsigned irq)
 {
-       if (irq >= IPIPE_NR_XIRQS)
+       if (irq >= IPIPE_NR_XIRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        return rthal_irq_chip_end(irq);
@@ -127,7 +127,9 @@ int rthal_irq_host_request(unsigned irq,
                           rthal_irq_host_handler_t handler,
                           char *name, void *dev_id)
 {
-       if (irq >= IPIPE_NR_XIRQS || !handler)
+       if (irq >= IPIPE_NR_XIRQS ||
+           handler == NULL ||
+           rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        if (rthal_linux_irq[irq].count++ == 0 && rthal_irq_descp(irq)->action) {
@@ -141,7 +143,9 @@ int rthal_irq_host_request(unsigned irq,
 
 int rthal_irq_host_release(unsigned irq, void *dev_id)
 {
-       if (irq >= IPIPE_NR_XIRQS || rthal_linux_irq[irq].count == 0)
+       if (irq >= IPIPE_NR_XIRQS ||
+           rthal_linux_irq[irq].count == 0 ||
+           rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        free_irq(irq, dev_id);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to