aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/xen/evtchn.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c
index 4356a9a030df..709c32d949bf 100644
--- a/drivers/xen/evtchn.c
+++ b/drivers/xen/evtchn.c
@@ -73,7 +73,7 @@ struct per_user_data {
73 * Who's bound to each port? This is logically an array of struct 73 * Who's bound to each port? This is logically an array of struct
74 * per_user_data *, but we encode the current enabled-state in bit 0. 74 * per_user_data *, but we encode the current enabled-state in bit 0.
75 */ 75 */
76static unsigned long port_user[NR_EVENT_CHANNELS]; 76static unsigned long *port_user;
77static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */ 77static DEFINE_SPINLOCK(port_user_lock); /* protects port_user[] and ring_prod */
78 78
79static inline struct per_user_data *get_port_user(unsigned port) 79static inline struct per_user_data *get_port_user(unsigned port)
@@ -522,8 +522,11 @@ static int __init evtchn_init(void)
522 if (!xen_domain()) 522 if (!xen_domain())
523 return -ENODEV; 523 return -ENODEV;
524 524
525 port_user = kcalloc(NR_EVENT_CHANNELS, sizeof(*port_user), GFP_KERNEL);
526 if (port_user == NULL)
527 return -ENOMEM;
528
525 spin_lock_init(&port_user_lock); 529 spin_lock_init(&port_user_lock);
526 memset(port_user, 0, sizeof(port_user));
527 530
528 /* Create '/dev/misc/evtchn'. */ 531 /* Create '/dev/misc/evtchn'. */
529 err = misc_register(&evtchn_miscdev); 532 err = misc_register(&evtchn_miscdev);
@@ -539,6 +542,9 @@ static int __init evtchn_init(void)
539 542
540static void __exit evtchn_cleanup(void) 543static void __exit evtchn_cleanup(void)
541{ 544{
545 kfree(port_user);
546 port_user = NULL;
547
542 misc_deregister(&evtchn_miscdev); 548 misc_deregister(&evtchn_miscdev);
543} 549}
544 550