|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] move error handling out of line to avoid duplicated code
# HG changeset patch
# User vhanquez@xxxxxxxxxxxxxxxxxxxxxxx
# Node ID 0fd894ba6ba0180b6c67ae953366e9554de24df5
# Parent 364128d29f4e1be517c3a962d19616726d9cb60b
move error handling out of line to avoid duplicated code.
Signed-off-by: Vincent Hanquez <vincent@xxxxxxxxxxxxx>
diff -r 364128d29f4e -r 0fd894ba6ba0
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Sat Dec 31
13:33:00 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c Sat Dec 31
14:16:13 2005
@@ -183,7 +183,7 @@
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 @@
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 @@
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)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] move error handling out of line to avoid duplicated code.,
Xen patchbot -unstable <=
|
|
|
|
|