X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fpci_passthrough.c;h=b8f921b5d962d61096bab91369bc8797224545af;hb=afca783e03bd737fe7bb02d498644df30bf5d4d9;hp=2ace0743b90977c8765b89685095294fa93be603;hpb=e2964f7234daa3429275c039769a313f0870c212;p=palacios.git diff --git a/palacios/src/devices/pci_passthrough.c b/palacios/src/devices/pci_passthrough.c index 2ace074..b8f921b 100644 --- a/palacios/src/devices/pci_passthrough.c +++ b/palacios/src/devices/pci_passthrough.c @@ -790,10 +790,11 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { strncpy(state->name, dev_id, 32); - dev = v3_allocate_device(dev_id, &dev_ops, state); + dev = v3_add_device(vm, dev_id, &dev_ops, state); - if (v3_attach_device(vm, dev) == -1) { + if (dev == NULL) { PrintError("Could not attach device %s\n", dev_id); + V3_Free(state); return -1; } @@ -804,6 +805,7 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { PrintError("Could not find PCI Device %s:%s\n", v3_cfg_val(cfg, "vendor_id"), v3_cfg_val(cfg, "device_id")); + v3_remove_device(dev); return 0; }