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

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

arm: always check whether irq descriptors are present

---

 ksrc/arch/arm/hal.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/ksrc/arch/arm/hal.c b/ksrc/arch/arm/hal.c
index 9086ef0..fa757c0 100644
--- a/ksrc/arch/arm/hal.c
+++ b/ksrc/arch/arm/hal.c
@@ -166,8 +166,10 @@ int rthal_irq_host_request(unsigned irq,
 {
     unsigned long flags;
 
-    if (irq >= IPIPE_NR_XIRQS || !handler)
-        return -EINVAL;
+    if (irq >= IPIPE_NR_XIRQS ||
+       handler == NULL ||
+       rthal_irq_descp(irq) == NULL)
+      return -EINVAL;
 
     spin_lock_irqsave(rthal_irq_desc_lock(irq), flags);
 
@@ -185,8 +187,10 @@ int rthal_irq_host_release(unsigned irq, void *dev_id)
 {
     unsigned long flags;
 
-    if (irq >= IPIPE_NR_XIRQS || rthal_linux_irq[irq].count == 0)
-        return -EINVAL;
+    if (irq >= IPIPE_NR_XIRQS ||
+       rthal_linux_irq[irq].count == 0 ||
+       rthal_irq_descp(irq) == NULL)
+      return -EINVAL;
 
     free_irq(irq, dev_id);
 
@@ -202,7 +206,7 @@ int rthal_irq_host_release(unsigned irq, void *dev_id)
 
 int rthal_irq_enable(unsigned irq)
 {
-    if (irq >= IPIPE_NR_XIRQS)
+    if (irq >= IPIPE_NR_XIRQS || rthal_irq_descp(irq) == NULL)
         return -EINVAL;
 
     /* We don't care of disable nesting level: real-time IRQ channels
@@ -213,14 +217,14 @@ 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_mark_irq_disabled(irq);
     return rthal_irq_chip_disable(irq);
 }
 
-int rthal_irq_end(unsigned irq)
+int rthal_irq_end(unsigned irq || rthal_irq_descp(irq) == NULL)
 {
     if (irq >= IPIPE_NR_XIRQS)
         return -EINVAL;


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

Reply via email to