libxl: only add PCI entries to xenstore if there is at least one PCI device
PATCH 1/1 libxl: only add PCI entries to xenstore if there is at least one PCI device
# HG changeset patch
# User royger
# Date 1311355474 -7200
# Node ID bb2568713604f2eef45326c271132b06a0bff1cc
# Parent e298ce67777eb45187d6581a0c51c2dbe7161000
libxl: only add PCI entries to xenstore if there is at least one PCI device.
Signed-off-by Roger Pau Monne <[email protected]>
tools/libxl/libxl_create.c +9 -7
@@ -528,15 +528,17 @@ static int do_domain_create(libxl__gc *g } } -for (i =0 ; i < d_config->num_pcidevs; i++) -libxl__device_pci_add (gc, domid, &d_config->pcidevs[i],1 ); +if (d_config->num_pcidevs >0 ) { +for (i =0 ; i < d_config->num_pcidevs; i++) +libxl__device_pci_add (gc, domid, &d_config->pcidevs[i],1 ); - ret =libxl__create_pci_backend (gc, domid, d_config->pcidevs, + ret =libxl__create_pci_backend (gc, domid, d_config->pcidevs, d_config->num_pcidevs); -if (ret <0 ) { -LIBXL__LOG (ctx,LIBXL__LOG_ERROR , -"libxl_create_pci_backend failed: %d" , ret); - goto error_out; +if (ret <0 ) { +LIBXL__LOG (ctx,LIBXL__LOG_ERROR , +"libxl_create_pci_backend failed: %d" , ret); + goto error_out; + } }if (!d_config->c_info.hvm && d_config->b_info.u.pv.e820_host) {