X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Flnx_virtio_nic.c;h=7609b0a8a0e122e36e42709028c2c376ee0aa7cb;hb=72420d58d18ec71d4777d029daaf0c6a1c820b32;hp=6da189319c7de848ed412a127eee5b4081f06300;hpb=e2964f7234daa3429275c039769a313f0870c212;p=palacios-OLD.git diff --git a/palacios/src/devices/lnx_virtio_nic.c b/palacios/src/devices/lnx_virtio_nic.c index 6da1893..7609b0a 100644 --- a/palacios/src/devices/lnx_virtio_nic.c +++ b/palacios/src/devices/lnx_virtio_nic.c @@ -805,14 +805,17 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { virtio_state->pci_bus = pci_bus; virtio_state->vm = vm; - struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state); - if (v3_attach_device(vm, dev) == -1) { + struct vm_device * dev = v3_add_device(vm, dev_id, &dev_ops, virtio_state); + + if (dev == NULL) { PrintError("Virtio NIC: Could not attach device %s\n", dev_id); + V3_Free(virtio_state); return -1; } if (v3_dev_add_net_frontend(vm, dev_id, connect_fn, (void *)virtio_state) == -1) { PrintError("Virtio NIC: Could not register %s as net frontend\n", dev_id); + v3_remove_device(dev); return -1; }