summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/amso1100/c2_provider.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/amso1100/c2_provider.c')
-rw-r--r--drivers/infiniband/hw/amso1100/c2_provider.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c
index da98d9f71429..fef972752912 100644
--- a/drivers/infiniband/hw/amso1100/c2_provider.c
+++ b/drivers/infiniband/hw/amso1100/c2_provider.c
@@ -757,20 +757,17 @@ static struct net_device *c2_pseudo_netdev_init(struct c2_dev *c2dev)
int c2_register_device(struct c2_dev *dev)
{
- int ret;
+ int ret = -ENOMEM;
int i;
/* Register pseudo network device */
dev->pseudo_netdev = c2_pseudo_netdev_init(dev);
- if (dev->pseudo_netdev) {
- ret = register_netdev(dev->pseudo_netdev);
- if (ret) {
- printk(KERN_ERR PFX
- "Unable to register netdev, ret = %d\n", ret);
- free_netdev(dev->pseudo_netdev);
- return ret;
- }
- }
+ if (!dev->pseudo_netdev)
+ goto out3;
+
+ ret = register_netdev(dev->pseudo_netdev);
+ if (ret)
+ goto out2;
pr_debug("%s:%u\n", __FUNCTION__, __LINE__);
strlcpy(dev->ibdev.name, "amso%d", IB_DEVICE_NAME_MAX);
@@ -848,21 +845,25 @@ int c2_register_device(struct c2_dev *dev)
ret = ib_register_device(&dev->ibdev);
if (ret)
- return ret;
+ goto out1;
for (i = 0; i < ARRAY_SIZE(c2_class_attributes); ++i) {
ret = class_device_create_file(&dev->ibdev.class_dev,
c2_class_attributes[i]);
- if (ret) {
- unregister_netdev(dev->pseudo_netdev);
- free_netdev(dev->pseudo_netdev);
- ib_unregister_device(&dev->ibdev);
- return ret;
- }
+ if (ret)
+ goto out0;
}
+ goto out3;
- pr_debug("%s:%u\n", __FUNCTION__, __LINE__);
- return 0;
+out0:
+ ib_unregister_device(&dev->ibdev);
+out1:
+ unregister_netdev(dev->pseudo_netdev);
+out2:
+ free_netdev(dev->pseudo_netdev);
+out3:
+ pr_debug("%s:%u ret=%d\n", __FUNCTION__, __LINE__, ret);
+ return ret;
}
void c2_unregister_device(struct c2_dev *dev)