ia64/xen-unstable

changeset 8780:ecc8595f2c0b

[IA64] evtchn_ia64 spin lock - fix dead lock

added spin_unlock() in case error occurs.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Thu Feb 09 13:48:05 2006 -0700 (2006-02-09)
parents 7b2399cb6508
children 6526a91d5555
files linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Thu Feb 09 13:43:39 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Thu Feb 09 13:48:05 2006 -0700
     1.3 @@ -106,8 +106,10 @@ int bind_virq_to_irqhandler(
     1.4      BUG_ON(HYPERVISOR_event_channel_op(&op) != 0 );
     1.5      evtchn = op.u.bind_virq.port;
     1.6  
     1.7 -    if (!unbound_irq(evtchn))
     1.8 -	return -EINVAL;
     1.9 +    if (!unbound_irq(evtchn)) {
    1.10 +        evtchn = -EINVAL;
    1.11 +        goto out;
    1.12 +    }
    1.13  
    1.14      evtchns[evtchn].handler = handler;
    1.15      evtchns[evtchn].dev_id = dev_id;
    1.16 @@ -115,6 +117,7 @@ int bind_virq_to_irqhandler(
    1.17      irq_info[evtchn] = mk_irq_info(IRQT_VIRQ, virq, evtchn);
    1.18  
    1.19      unmask_evtchn(evtchn);
    1.20 +out:
    1.21      spin_unlock(&irq_mapping_update_lock);
    1.22      return evtchn;
    1.23  }
    1.24 @@ -125,8 +128,10 @@ int bind_evtchn_to_irqhandler(unsigned i
    1.25  {
    1.26      spin_lock(&irq_mapping_update_lock);
    1.27  
    1.28 -    if (!unbound_irq(evtchn))
    1.29 -	return -EINVAL;
    1.30 +    if (!unbound_irq(evtchn)) {
    1.31 +	evtchn = -EINVAL;
    1.32 +	goto out;
    1.33 +    }
    1.34  
    1.35      evtchns[evtchn].handler = handler;
    1.36      evtchns[evtchn].dev_id = dev_id;
    1.37 @@ -134,6 +139,7 @@ int bind_evtchn_to_irqhandler(unsigned i
    1.38      irq_info[evtchn] = mk_irq_info(IRQT_EVTCHN, 0, evtchn);
    1.39  
    1.40      unmask_evtchn(evtchn);
    1.41 +out:
    1.42      spin_unlock(&irq_mapping_update_lock);
    1.43      return evtchn;
    1.44  }
    1.45 @@ -158,7 +164,7 @@ void unbind_from_irqhandler(unsigned int
    1.46      spin_lock(&irq_mapping_update_lock);
    1.47  
    1.48      if (unbound_irq(irq))
    1.49 -        return;
    1.50 +        goto out;
    1.51  
    1.52      op.cmd = EVTCHNOP_close;
    1.53      op.u.close.port = evtchn;
    1.54 @@ -179,6 +185,7 @@ void unbind_from_irqhandler(unsigned int
    1.55      evtchns[evtchn].handler = NULL;
    1.56      evtchns[evtchn].opened = 0;
    1.57  
    1.58 +out:
    1.59      spin_unlock(&irq_mapping_update_lock);
    1.60  }
    1.61