aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/mmtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/mmtimer.c')
-rw-r--r--drivers/char/mmtimer.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index 22b9905c1e52..c09160383a53 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -680,7 +680,7 @@ static int __init mmtimer_init(void)
680 if (sn_rtc_cycles_per_second < 100000) { 680 if (sn_rtc_cycles_per_second < 100000) {
681 printk(KERN_ERR "%s: unable to determine clock frequency\n", 681 printk(KERN_ERR "%s: unable to determine clock frequency\n",
682 MMTIMER_NAME); 682 MMTIMER_NAME);
683 return -1; 683 goto out1;
684 } 684 }
685 685
686 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second / 686 mmtimer_femtoperiod = ((unsigned long)1E15 + sn_rtc_cycles_per_second /
@@ -689,13 +689,13 @@ static int __init mmtimer_init(void)
689 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) { 689 if (request_irq(SGI_MMTIMER_VECTOR, mmtimer_interrupt, IRQF_PERCPU, MMTIMER_NAME, NULL)) {
690 printk(KERN_WARNING "%s: unable to allocate interrupt.", 690 printk(KERN_WARNING "%s: unable to allocate interrupt.",
691 MMTIMER_NAME); 691 MMTIMER_NAME);
692 return -1; 692 goto out1;
693 } 693 }
694 694
695 if (misc_register(&mmtimer_miscdev)) { 695 if (misc_register(&mmtimer_miscdev)) {
696 printk(KERN_ERR "%s: failed to register device\n", 696 printk(KERN_ERR "%s: failed to register device\n",
697 MMTIMER_NAME); 697 MMTIMER_NAME);
698 return -1; 698 goto out2;
699 } 699 }
700 700
701 /* Get max numbered node, calculate slots needed */ 701 /* Get max numbered node, calculate slots needed */
@@ -709,16 +709,18 @@ static int __init mmtimer_init(void)
709 if (timers == NULL) { 709 if (timers == NULL) {
710 printk(KERN_ERR "%s: failed to allocate memory for device\n", 710 printk(KERN_ERR "%s: failed to allocate memory for device\n",
711 MMTIMER_NAME); 711 MMTIMER_NAME);
712 return -1; 712 goto out3;
713 } 713 }
714 714
715 memset(timers,0,(sizeof(mmtimer_t *)*maxn));
716
715 /* Allocate mmtimer_t's for each online node */ 717 /* Allocate mmtimer_t's for each online node */
716 for_each_online_node(node) { 718 for_each_online_node(node) {
717 timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node); 719 timers[node] = kmalloc_node(sizeof(mmtimer_t)*NUM_COMPARATORS, GFP_KERNEL, node);
718 if (timers[node] == NULL) { 720 if (timers[node] == NULL) {
719 printk(KERN_ERR "%s: failed to allocate memory for device\n", 721 printk(KERN_ERR "%s: failed to allocate memory for device\n",
720 MMTIMER_NAME); 722 MMTIMER_NAME);
721 return -1; 723 goto out4;
722 } 724 }
723 for (i=0; i< NUM_COMPARATORS; i++) { 725 for (i=0; i< NUM_COMPARATORS; i++) {
724 mmtimer_t * base = timers[node] + i; 726 mmtimer_t * base = timers[node] + i;
@@ -739,6 +741,17 @@ static int __init mmtimer_init(void)
739 sn_rtc_cycles_per_second/(unsigned long)1E6); 741 sn_rtc_cycles_per_second/(unsigned long)1E6);
740 742
741 return 0; 743 return 0;
744
745out4:
746 for_each_online_node(node) {
747 kfree(timers[node]);
748 }
749out3:
750 misc_deregister(&mmtimer_miscdev);
751out2:
752 free_irq(SGI_MMTIMER_VECTOR, NULL);
753out1:
754 return -1;
742} 755}
743 756
744module_init(mmtimer_init); 757module_init(mmtimer_init);