[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v8][PATCH 06/16] hvmloader/pci: disable all pci devices conflicting with rdm



 > Except that this isn't valid C (no statement following the label). I can
accept goto-s for some error handling cases where the alternatives
might be considered even more ugly than using goto. But the way
this or your original proposal look, I'd rather not have goto-s used
like this.


What about this?

+    bool is_conflict = false;

     for ( devfn = 0; devfn < 256; devfn++ )
     {
@@ -60,7 +61,7 @@ static void disable_conflicting_devices(void)
             continue;

         /* Check all bars */
-        for ( bar = 0; bar < 7; bar++ )
+        for ( bar = 0; bar < 7 && !is_conflict; bar++ )
         {
             bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
             if ( bar == 6 )
@@ -89,7 +90,7 @@ static void disable_conflicting_devices(void)
             bar_sz = pci_readl(devfn, bar_reg);
             bar_sz &= PCI_BASE_ADDRESS_MEM_MASK;

-            for ( i = 0; i < memory_map.nr_map ; i++ )
+            for ( i = 0; i < memory_map.nr_map && !is_conflict; i++ )
             {
                 if ( memory_map.map[i].type == E820_RESERVED )
                 {
@@ -105,13 +106,13 @@ static void disable_conflicting_devices(void)
                                devfn>>3, devfn&7, bar_reg, bar_data);
                         cmd = pci_readw(devfn, PCI_COMMAND);
                         pci_writew(devfn, PCI_COMMAND, ~cmd);
-                        /* Jump next device. */
-                        goto check_next_device;
+                        /* So need to jump next device. */
+                        is_conflict = true;
                     }
                 }
             }
         }
- check_next_device:
+        is_conflict = false;
     }
 }

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.