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

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

blackfin: always check whether irq descriptors are present

---

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

diff --git a/ksrc/arch/blackfin/hal.c b/ksrc/arch/blackfin/hal.c
index a41f756..5884b77 100644
--- a/ksrc/arch/blackfin/hal.c
+++ b/ksrc/arch/blackfin/hal.c
@@ -312,7 +312,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;
@@ -323,7 +323,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;
@@ -333,7 +333,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);
@@ -343,7 +343,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) {
@@ -357,7 +359,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