[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>
This commit is contained in:
committed by
David S. Miller
parent
c3c4ed652e
commit
70ff3b66d7
@@ -1482,14 +1482,14 @@ static int __init rose_proto_init(void)
|
|||||||
if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {
|
if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) {
|
||||||
printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");
|
printk(KERN_ERR "ROSE: rose_proto_init - rose_ndevs parameter to large\n");
|
||||||
proto_unregister(&rose_proto);
|
proto_unregister(&rose_proto);
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
dev_rose = kmalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL);
|
||||||
if (dev_rose == NULL) {
|
if (dev_rose == NULL) {
|
||||||
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
|
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate device structure\n");
|
||||||
proto_unregister(&rose_proto);
|
proto_unregister(&rose_proto);
|
||||||
return -1;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));
|
memset(dev_rose, 0x00, rose_ndevs * sizeof(struct net_device*));
|
||||||
@@ -1502,9 +1502,11 @@ static int __init rose_proto_init(void)
|
|||||||
name, rose_setup);
|
name, rose_setup);
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");
|
printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");
|
||||||
|
rc = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (register_netdev(dev)) {
|
rc = register_netdev(dev);
|
||||||
|
if (rc) {
|
||||||
printk(KERN_ERR "ROSE: netdevice regeistration failed\n");
|
printk(KERN_ERR "ROSE: netdevice regeistration failed\n");
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1539,7 +1541,7 @@ fail:
|
|||||||
}
|
}
|
||||||
kfree(dev_rose);
|
kfree(dev_rose);
|
||||||
proto_unregister(&rose_proto);
|
proto_unregister(&rose_proto);
|
||||||
return -ENOMEM;
|
goto out;
|
||||||
}
|
}
|
||||||
module_init(rose_proto_init);
|
module_init(rose_proto_init);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user