ia64/xen-unstable

changeset 8934:011d6df76979

alloc_netdev must be freed with free_netdev, not directly by kfree.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Mon Feb 20 17:06:36 2006 +0000 (2006-02-20)
parents bea58b594c4a
children e9e319c61a1e
files linux-2.6-xen-sparse/drivers/xen/netback/loopback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Mon Feb 20 16:49:35 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/loopback.c	Mon Feb 20 17:06:36 2006 +0000
     1.3 @@ -137,10 +137,13 @@ static int __init make_loopback(int i)
     1.4  
     1.5  	sprintf(dev_name, "vif0.%d", i);
     1.6  	dev1 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
     1.7 +	if (!dev1)
     1.8 +		return err;
     1.9 +
    1.10  	sprintf(dev_name, "veth%d", i);
    1.11  	dev2 = alloc_netdev(sizeof(struct net_private), dev_name, ether_setup);
    1.12 -	if ((dev1 == NULL) || (dev2 == NULL))
    1.13 -		goto fail;
    1.14 +	if (!dev2)
    1.15 +		goto fail_netdev2;
    1.16  
    1.17  	loopback_construct(dev1, dev2);
    1.18  	loopback_construct(dev2, dev1);
    1.19 @@ -169,8 +172,9 @@ static int __init make_loopback(int i)
    1.20  	return 0;
    1.21  
    1.22   fail:
    1.23 -	kfree(dev1);
    1.24 -	kfree(dev2);
    1.25 +	free_netdev(dev2);
    1.26 + fail_netdev2:
    1.27 +	free_netdev(dev1);
    1.28  	return err;
    1.29  }
    1.30