diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2005-09-27 18:43:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-09-27 18:43:46 -0400 |
commit | 70ff3b66d79c5110e533f3f2aea1a5b2fc5f8d90 (patch) | |
tree | 49eb955f8989de09ae4a77fcf8b92538f4a76bdb /net/rose/af_rose.c | |
parent | c3c4ed652e8f2c348ebdd3f2e45664a0e238ee52 (diff) |
[ROSE]: return sane -E* from rose_proto_init()
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose/af_rose.c')
-rw-r--r-- | net/rose/af_rose.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index a190eaee702e..dbfb0e3dc798 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -1482,14 +1482,14 @@ static int __init rose_proto_init(void) | |||
1482 | if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { | 1482 | if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { |
1483 | printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); | 1483 | printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n"); |
1484 | proto_unregister(&rose_proto); | 1484 | proto_unregister(&rose_proto); |
1485 | return -1; | 1485 | return -EINVAL; |
1486 | } | 1486 | } |
1487 | 1487 | ||
1488 | dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); | 1488 | dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); |
1489 | if (dev_rose == NULL) { | 1489 | if (dev_rose == NULL) { |
1490 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); | 1490 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n"); |
1491 | proto_unregister(&rose_proto); | 1491 | proto_unregister(&rose_proto); |
1492 | return -1; | 1492 | return -ENOMEM; |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); | 1495 | memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*)); |
@@ -1502,9 +1502,11 @@ static int __init rose_proto_init(void) | |||
1502 | name, rose_setup); | 1502 | name, rose_setup); |
1503 | if (!dev) { | 1503 | if (!dev) { |
1504 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); | 1504 | printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n"); |
1505 | rc = -ENOMEM; | ||
1505 | goto fail; | 1506 | goto fail; |
1506 | } | 1507 | } |
1507 | if (register_netdev(dev)) { | 1508 | rc = register_netdev(dev); |
1509 | if (rc) { | ||
1508 | printk(KERN_ERR "ROSE: netdevice regeistration failed\n"); | 1510 | printk(KERN_ERR "ROSE: netdevice regeistration failed\n"); |
1509 | free_netdev(dev); | 1511 | free_netdev(dev); |
1510 | goto fail; | 1512 | goto fail; |
@@ -1539,7 +1541,7 @@ fail: | |||
1539 | } | 1541 | } |
1540 | kfree(dev_rose); | 1542 | kfree(dev_rose); |
1541 | proto_unregister(&rose_proto); | 1543 | proto_unregister(&rose_proto); |
1542 | return -ENOMEM; | 1544 | goto out; |
1543 | } | 1545 | } |
1544 | module_init(rose_proto_init); | 1546 | module_init(rose_proto_init); |
1545 | 1547 | ||