WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86/HPET: fix oversight in 23033:84bacd80

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/HPET: fix oversight in 23033:84bacd800bf8 (2nd try)
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Sun, 20 Mar 2011 06:40:24 +0000
Delivery-date: Sat, 19 Mar 2011 23:43:10 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxxxx>
# Date 1300368761 0
# Node ID c0a717aa8415ae975ad58b9756cd2b82e4da0319
# Parent  93c864c16ab19756e44da20a6c3d09c3a3ce948e
x86/HPET: fix oversight in 23033:84bacd800bf8 (2nd try)

Clearly for the adjusted BUG_ON()s to not yield false positives
num_hpets_used (rather than num_chs_used, as done mistakenly in
23042:599ceb5b0a9b) must be incremented before setting up an IRQ (and
decremented back when the setup failed). To avoid further confusion,
just eliminate the local variable altogether.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---


diff -r 93c864c16ab1 -r c0a717aa8415 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Thu Mar 17 13:31:43 2011 +0000
+++ b/xen/arch/x86/hpet.c       Thu Mar 17 13:32:41 2011 +0000
@@ -392,17 +392,17 @@
     return irq;
 }
 
-static unsigned int __init hpet_fsb_cap_lookup(void)
+static void __init hpet_fsb_cap_lookup(void)
 {
     u32 id;
-    unsigned int i, num_chs, num_chs_used;
+    unsigned int i, num_chs;
 
     /* TODO. */
     if ( iommu_intremap )
     {
         printk(XENLOG_INFO "HPET's MSI mode hasn't been supported when "
             "Interrupt Remapping is enabled.\n");
-        return 0;
+        return;
     }
 
     id = hpet_read32(HPET_ID);
@@ -412,13 +412,12 @@
 
     hpet_events = xmalloc_array(struct hpet_event_channel, num_chs);
     if ( !hpet_events )
-        return 0;
+        return;
     memset(hpet_events, 0, num_chs * sizeof(*hpet_events));
 
-    num_chs_used = 0;
     for ( i = 0; i < num_chs; i++ )
     {
-        struct hpet_event_channel *ch = &hpet_events[num_chs_used];
+        struct hpet_event_channel *ch = &hpet_events[num_hpets_used];
         u32 cfg = hpet_read32(HPET_Tn_CFG(i));
 
         /* Only consider HPET timer with MSI support */
@@ -428,14 +427,12 @@
         ch->flags = 0;
         ch->idx = i;
 
-        if ( (ch->irq = hpet_assign_irq(num_chs_used++)) < 0 )
-            num_chs_used--;
+        if ( (ch->irq = hpet_assign_irq(num_hpets_used++)) < 0 )
+            num_hpets_used--;
     }
 
     printk(XENLOG_INFO "HPET: %u timers (%u will be used for broadcast)\n",
-           num_chs, num_chs_used);
-
-    return num_chs_used;
+           num_chs, num_hpets_used);
 }
 
 static struct hpet_event_channel *hpet_get_channel(unsigned int cpu)
@@ -555,7 +552,7 @@
 
     cfg = hpet_read32(HPET_CFG);
 
-    num_hpets_used = hpet_fsb_cap_lookup();
+    hpet_fsb_cap_lookup();
     if ( num_hpets_used > 0 )
     {
         /* Stop HPET legacy interrupts */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86/HPET: fix oversight in 23033:84bacd800bf8 (2nd try), Xen patchbot-unstable <=