diff options
| -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 | ||
