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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jan 11 17:08:38 2010 +0100

powerpc: always check whether irq descriptors are present

---

 ksrc/arch/powerpc/hal.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/ksrc/arch/powerpc/hal.c b/ksrc/arch/powerpc/hal.c
index bfa05c5..e45c6d8 100644
--- a/ksrc/arch/powerpc/hal.c
+++ b/ksrc/arch/powerpc/hal.c
@@ -58,12 +58,6 @@
 #define DBG(fmt...)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
-#define rthal_irq_handlerp(irq) rthal_irq_descp(irq)->handler
-#else
-#define rthal_irq_handlerp(irq) rthal_irq_descp(irq)->chip
-#endif
-
 static struct {
        unsigned long flags;
        int count;
@@ -347,7 +341,9 @@ int rthal_irq_host_request(unsigned irq,
 {
        unsigned long flags;
 
-       if (irq >= IPIPE_NR_XIRQS || !handler)
+       if (irq >= IPIPE_NR_XIRQS ||
+           handler == NULL ||
+           rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        spin_lock_irqsave(&rthal_irq_descp(irq)->lock, flags);
@@ -366,7 +362,9 @@ int rthal_irq_host_release(unsigned irq, void *dev_id)
 {
        unsigned long flags;
 
-       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);
@@ -383,7 +381,7 @@ int rthal_irq_host_release(unsigned irq, void *dev_id)
 
 int rthal_irq_enable(unsigned irq)
 {
-       if (irq >= NR_IRQS)
+       if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        rthal_irq_desc_status(irq) &= ~IRQ_DISABLED;
@@ -393,8 +391,7 @@ int rthal_irq_enable(unsigned irq)
 
 int rthal_irq_disable(unsigned irq)
 {
-
-       if (irq >= NR_IRQS)
+       if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        rthal_irq_desc_status(irq) |= IRQ_DISABLED;
@@ -404,7 +401,7 @@ int rthal_irq_disable(unsigned irq)
 
 int rthal_irq_end(unsigned irq)
 {
-       if (irq >= NR_IRQS)
+       if (irq >= NR_IRQS || rthal_irq_descp(irq) == NULL)
                return -EINVAL;
 
        return rthal_irq_chip_end(irq);


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

Reply via email to