diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-01-03 14:36:56 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-01-03 14:36:56 +0100 |
commit | 8f5424c6bb7becdf17aee005d285de9d83b293b3 (patch) | |
tree | acec85fc2735d8f3ebd0e45fc2ddf33400d3a18d | |
parent | 29c3bf78b960d21bf31dc04724b7bf26d0809437 (diff) | |
parent | 28d7365b019098f6a039d1735df4bbcbab6a9104 (diff) | |
download | xen-8f5424c6bb7becdf17aee005d285de9d83b293b3.tar.gz xen-8f5424c6bb7becdf17aee005d285de9d83b293b3.tar.bz2 xen-8f5424c6bb7becdf17aee005d285de9d83b293b3.zip |
merge
5 files changed, 44 insertions, 63 deletions
diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c index 9228cb5190..34d3399a8e 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c @@ -540,6 +540,9 @@ static int __init blkif_init(void) pending_vaddrs = kmalloc(sizeof(pending_vaddrs[0]) * mmap_pages, GFP_KERNEL); if (!pending_reqs || !pending_grant_handles || !pending_vaddrs) { + kfree(pending_reqs); + kfree(pending_grant_handles); + kfree(pending_vaddrs); printk("%s: out of memory\n", __FUNCTION__); return -1; } diff --git a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c index 299a4a5a59..f3779734ef 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c +++ b/linux-2.6-xen-sparse/drivers/xen/blktap/blktap.c @@ -225,7 +225,7 @@ static int blktap_open(struct inode *inode, struct file *filp) /* Allocate the fe ring. */ sring = (blkif_sring_t *)get_zeroed_page(GFP_KERNEL); if (sring == NULL) - goto fail_nomem; + return -ENOMEM; SetPageReserved(virt_to_page(sring)); @@ -233,9 +233,6 @@ static int blktap_open(struct inode *inode, struct file *filp) FRONT_RING_INIT(&blktap_ufe_ring, sring, PAGE_SIZE); return 0; - - fail_nomem: - return -ENOMEM; } static int blktap_release(struct inode *inode, struct file *filp) @@ -391,12 +388,12 @@ void blktap_kick_user(void) } static struct file_operations blktap_fops = { - owner: THIS_MODULE, - poll: blktap_poll, - ioctl: blktap_ioctl, - open: blktap_open, - release: blktap_release, - mmap: blktap_mmap, + .owner = THIS_MODULE, + .poll = blktap_poll, + .ioctl = blktap_ioctl, + .open = blktap_open, + .release = blktap_release, + .mmap = blktap_mmap, }; diff --git a/linux-2.6-xen-sparse/drivers/xen/console/console.c b/linux-2.6-xen-sparse/drivers/xen/console/console.c index 9183a47af8..44ae31d087 100644 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c @@ -314,39 +314,31 @@ static void __xencons_tx_flush(void) { int sent, sz, work_done = 0; - if (xen_start_info->flags & SIF_INITDOMAIN) { - if (x_char) { + if (x_char) { + if (xen_start_info->flags & SIF_INITDOMAIN) kcons_write_dom0(NULL, &x_char, 1); - x_char = 0; - work_done = 1; - } + else + while (x_char) + if (xencons_ring_send(&x_char, 1) == 1) + break; + x_char = 0; + work_done = 1; + } - while (wc != wp) { - sz = wp - wc; - if (sz > (wbuf_size - WBUF_MASK(wc))) - sz = wbuf_size - WBUF_MASK(wc); + while (wc != wp) { + sz = wp - wc; + if (sz > (wbuf_size - WBUF_MASK(wc))) + sz = wbuf_size - WBUF_MASK(wc); + if (xen_start_info->flags & SIF_INITDOMAIN) { kcons_write_dom0(NULL, &wbuf[WBUF_MASK(wc)], sz); wc += sz; - work_done = 1; - } - } else { - while (x_char) { - if (xencons_ring_send(&x_char, 1) == 1) { - x_char = 0; - work_done = 1; - } - } - - while (wc != wp) { - sz = wp - wc; - if (sz > (wbuf_size - WBUF_MASK(wc))) - sz = wbuf_size - WBUF_MASK(wc); + } else { sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz); if (sent == 0) break; wc += sent; - work_done = 1; } + work_done = 1; } if (work_done && (xencons_tty != NULL)) { diff --git a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c index 16cc929a11..a27533cf87 100644 --- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c +++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c @@ -183,7 +183,7 @@ static void unmap_frontend_pages(netif_t *netif) int netif_map(netif_t *netif, unsigned long tx_ring_ref, unsigned long rx_ring_ref, unsigned int evtchn) { - int err; + int err = -ENOMEM; netif_tx_sring_t *txs; netif_rx_sring_t *rxs; evtchn_op_t op = { @@ -199,25 +199,16 @@ int netif_map(netif_t *netif, unsigned long tx_ring_ref, if (netif->tx_comms_area == NULL) return -ENOMEM; netif->rx_comms_area = alloc_vm_area(PAGE_SIZE); - if (netif->rx_comms_area == NULL) { - free_vm_area(netif->tx_comms_area); - return -ENOMEM; - } + if (netif->rx_comms_area == NULL) + goto err_rx; err = map_frontend_pages(netif, tx_ring_ref, rx_ring_ref); - if (err) { - free_vm_area(netif->tx_comms_area); - free_vm_area(netif->rx_comms_area); - return err; - } + if (err) + goto err_map; err = HYPERVISOR_event_channel_op(&op); - if (err) { - unmap_frontend_pages(netif); - free_vm_area(netif->tx_comms_area); - free_vm_area(netif->rx_comms_area); - return err; - } + if (err) + goto err_hypervisor; netif->evtchn = op.u.bind_interdomain.local_port; @@ -245,6 +236,13 @@ int netif_map(netif_t *netif, unsigned long tx_ring_ref, rtnl_unlock(); return 0; +err_hypervisor: + unmap_frontend_pages(netif); +err_map: + free_vm_area(netif->rx_comms_area); +err_rx: + free_vm_area(netif->tx_comms_area); + return err; } static void free_netif_callback(void *arg) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index 09001a5463..176d53ca76 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -542,14 +542,6 @@ static int xenbus_probe_node(struct xen_bus_type *bus, const char *type, const char *nodename) { -#define CHECK_FAIL \ - do { \ - if (err) \ - goto fail; \ - } \ - while (0) \ - - int err; struct xenbus_device *xendev; size_t stringlen; @@ -584,19 +576,18 @@ static int xenbus_probe_node(struct xen_bus_type *bus, xendev->dev.release = xenbus_dev_release; err = bus->get_bus_id(xendev->dev.bus_id, xendev->nodename); - CHECK_FAIL; + if (err) + goto fail; /* Register with generic device framework. */ err = device_register(&xendev->dev); - CHECK_FAIL; + if (err) + goto fail; device_create_file(&xendev->dev, &dev_attr_nodename); device_create_file(&xendev->dev, &dev_attr_devtype); return 0; - -#undef CHECK_FAIL - fail: xenbus_dev_free(xendev); return err; |