From: Keir Fraser Date: Thu, 31 Jul 2008 12:30:24 +0000 (+0100) Subject: mini-os: make init_pcifront fail early if there is no backend X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14165^2~64 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=adacb92a2b5e3ef66b924dc59ab1c2b2c98195c6;p=xen.git mini-os: make init_pcifront fail early if there is no backend Else, we would leave entries in xenstore, which disturbs xend. Signed-off-by: Samuel Thibault --- diff --git a/extras/mini-os/pcifront.c b/extras/mini-os/pcifront.c index a924a6e8d9..5b68d86b56 100644 --- a/extras/mini-os/pcifront.c +++ b/extras/mini-os/pcifront.c @@ -57,6 +57,7 @@ struct pcifront_dev *init_pcifront(char *_nodename) int retry=0; char* msg; char* nodename = _nodename ? _nodename : "device/pci/0"; + int dom; struct pcifront_dev *dev; @@ -64,12 +65,18 @@ struct pcifront_dev *init_pcifront(char *_nodename) printk("******************* PCIFRONT for %s **********\n\n\n", nodename); + snprintf(path, sizeof(path), "%s/backend-id", nodename); + dom = xenbus_read_integer(path); + if (dom == -1) { + printk("no backend\n"); + return NULL; + } + dev = malloc(sizeof(*dev)); memset(dev, 0, sizeof(*dev)); dev->nodename = strdup(nodename); + dev->dom = dom; - snprintf(path, sizeof(path), "%s/backend-id", nodename); - dev->dom = xenbus_read_integer(path); evtchn_alloc_unbound(dev->dom, pcifront_handler, dev, &dev->evtchn); dev->info = (struct xen_pci_sharedinfo*) alloc_page();