diff options
Diffstat (limited to 'drivers/xen/evtchn.c')
-rw-r--r-- | drivers/xen/evtchn.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index b1f60a0c0bea..45c8efaa6b3e 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
@@ -269,6 +269,14 @@ static int evtchn_bind_to_user(struct per_user_data *u, int port) | |||
269 | u->name, (void *)(unsigned long)port); | 269 | u->name, (void *)(unsigned long)port); |
270 | if (rc >= 0) | 270 | if (rc >= 0) |
271 | rc = evtchn_make_refcounted(port); | 271 | rc = evtchn_make_refcounted(port); |
272 | else { | ||
273 | /* bind failed, should close the port now */ | ||
274 | struct evtchn_close close; | ||
275 | close.port = port; | ||
276 | if (HYPERVISOR_event_channel_op(EVTCHNOP_close, &close) != 0) | ||
277 | BUG(); | ||
278 | set_port_user(port, NULL); | ||
279 | } | ||
272 | 280 | ||
273 | return rc; | 281 | return rc; |
274 | } | 282 | } |
@@ -277,6 +285,8 @@ static void evtchn_unbind_from_user(struct per_user_data *u, int port) | |||
277 | { | 285 | { |
278 | int irq = irq_from_evtchn(port); | 286 | int irq = irq_from_evtchn(port); |
279 | 287 | ||
288 | BUG_ON(irq < 0); | ||
289 | |||
280 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); | 290 | unbind_from_irqhandler(irq, (void *)(unsigned long)port); |
281 | 291 | ||
282 | set_port_user(port, NULL); | 292 | set_port_user(port, NULL); |
@@ -534,10 +544,10 @@ static int __init evtchn_init(void) | |||
534 | 544 | ||
535 | spin_lock_init(&port_user_lock); | 545 | spin_lock_init(&port_user_lock); |
536 | 546 | ||
537 | /* Create '/dev/misc/evtchn'. */ | 547 | /* Create '/dev/xen/evtchn'. */ |
538 | err = misc_register(&evtchn_miscdev); | 548 | err = misc_register(&evtchn_miscdev); |
539 | if (err != 0) { | 549 | if (err != 0) { |
540 | printk(KERN_ALERT "Could not register /dev/misc/evtchn\n"); | 550 | printk(KERN_ERR "Could not register /dev/xen/evtchn\n"); |
541 | return err; | 551 | return err; |
542 | } | 552 | } |
543 | 553 | ||