Commit 4275a5b2 authored by Hariprasad S's avatar Hariprasad S Committed by Doug Ledford

iw_cxgb4: Fixes GW-Basic labels to meaningful error names

Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 82b1df1b
...@@ -315,14 +315,12 @@ static int qp_release(struct inode *inode, struct file *file) ...@@ -315,14 +315,12 @@ static int qp_release(struct inode *inode, struct file *file)
static int qp_open(struct inode *inode, struct file *file) static int qp_open(struct inode *inode, struct file *file)
{ {
struct c4iw_debugfs_data *qpd; struct c4iw_debugfs_data *qpd;
int ret = 0;
int count = 1; int count = 1;
qpd = kmalloc(sizeof *qpd, GFP_KERNEL); qpd = kmalloc(sizeof *qpd, GFP_KERNEL);
if (!qpd) { if (!qpd)
ret = -ENOMEM; return -ENOMEM;
goto out;
}
qpd->devp = inode->i_private; qpd->devp = inode->i_private;
qpd->pos = 0; qpd->pos = 0;
...@@ -333,8 +331,8 @@ static int qp_open(struct inode *inode, struct file *file) ...@@ -333,8 +331,8 @@ static int qp_open(struct inode *inode, struct file *file)
qpd->bufsize = count * 128; qpd->bufsize = count * 128;
qpd->buf = vmalloc(qpd->bufsize); qpd->buf = vmalloc(qpd->bufsize);
if (!qpd->buf) { if (!qpd->buf) {
ret = -ENOMEM; kfree(qpd);
goto err1; return -ENOMEM;
} }
spin_lock_irq(&qpd->devp->lock); spin_lock_irq(&qpd->devp->lock);
...@@ -343,11 +341,7 @@ static int qp_open(struct inode *inode, struct file *file) ...@@ -343,11 +341,7 @@ static int qp_open(struct inode *inode, struct file *file)
qpd->buf[qpd->pos++] = 0; qpd->buf[qpd->pos++] = 0;
file->private_data = qpd; file->private_data = qpd;
goto out; return 0;
err1:
kfree(qpd);
out:
return ret;
} }
static const struct file_operations qp_debugfs_fops = { static const struct file_operations qp_debugfs_fops = {
...@@ -781,8 +775,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) ...@@ -781,8 +775,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
pr_err(MOD "%s: unsupported udb/ucq densities %u/%u\n", pr_err(MOD "%s: unsupported udb/ucq densities %u/%u\n",
pci_name(rdev->lldi.pdev), rdev->lldi.udb_density, pci_name(rdev->lldi.pdev), rdev->lldi.udb_density,
rdev->lldi.ucq_density); rdev->lldi.ucq_density);
err = -EINVAL; return -EINVAL;
goto err1;
} }
if (rdev->lldi.vr->qp.start != rdev->lldi.vr->cq.start || if (rdev->lldi.vr->qp.start != rdev->lldi.vr->cq.start ||
rdev->lldi.vr->qp.size != rdev->lldi.vr->cq.size) { rdev->lldi.vr->qp.size != rdev->lldi.vr->cq.size) {
...@@ -791,8 +784,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) ...@@ -791,8 +784,7 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
pci_name(rdev->lldi.pdev), rdev->lldi.vr->qp.start, pci_name(rdev->lldi.pdev), rdev->lldi.vr->qp.start,
rdev->lldi.vr->qp.size, rdev->lldi.vr->cq.size, rdev->lldi.vr->qp.size, rdev->lldi.vr->cq.size,
rdev->lldi.vr->cq.size); rdev->lldi.vr->cq.size);
err = -EINVAL; return -EINVAL;
goto err1;
} }
rdev->qpmask = rdev->lldi.udb_density - 1; rdev->qpmask = rdev->lldi.udb_density - 1;
...@@ -816,10 +808,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) ...@@ -816,10 +808,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
rdev->lldi.db_reg, rdev->lldi.gts_reg, rdev->lldi.db_reg, rdev->lldi.gts_reg,
rdev->qpmask, rdev->cqmask); rdev->qpmask, rdev->cqmask);
if (c4iw_num_stags(rdev) == 0) { if (c4iw_num_stags(rdev) == 0)
err = -EINVAL; return -EINVAL;
goto err1;
}
rdev->stats.pd.total = T4_MAX_NUM_PD; rdev->stats.pd.total = T4_MAX_NUM_PD;
rdev->stats.stag.total = rdev->lldi.vr->stag.size; rdev->stats.stag.total = rdev->lldi.vr->stag.size;
...@@ -831,22 +821,22 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) ...@@ -831,22 +821,22 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
err = c4iw_init_resource(rdev, c4iw_num_stags(rdev), T4_MAX_NUM_PD); err = c4iw_init_resource(rdev, c4iw_num_stags(rdev), T4_MAX_NUM_PD);
if (err) { if (err) {
printk(KERN_ERR MOD "error %d initializing resources\n", err); printk(KERN_ERR MOD "error %d initializing resources\n", err);
goto err1; return err;
} }
err = c4iw_pblpool_create(rdev); err = c4iw_pblpool_create(rdev);
if (err) { if (err) {
printk(KERN_ERR MOD "error %d initializing pbl pool\n", err); printk(KERN_ERR MOD "error %d initializing pbl pool\n", err);
goto err2; goto destroy_resource;
} }
err = c4iw_rqtpool_create(rdev); err = c4iw_rqtpool_create(rdev);
if (err) { if (err) {
printk(KERN_ERR MOD "error %d initializing rqt pool\n", err); printk(KERN_ERR MOD "error %d initializing rqt pool\n", err);
goto err3; goto destroy_pblpool;
} }
err = c4iw_ocqp_pool_create(rdev); err = c4iw_ocqp_pool_create(rdev);
if (err) { if (err) {
printk(KERN_ERR MOD "error %d initializing ocqp pool\n", err); printk(KERN_ERR MOD "error %d initializing ocqp pool\n", err);
goto err4; goto destroy_rqtpool;
} }
rdev->status_page = (struct t4_dev_status_page *) rdev->status_page = (struct t4_dev_status_page *)
__get_free_page(GFP_KERNEL); __get_free_page(GFP_KERNEL);
...@@ -873,13 +863,12 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev) ...@@ -873,13 +863,12 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
return 0; return 0;
destroy_ocqp_pool: destroy_ocqp_pool:
c4iw_ocqp_pool_destroy(rdev); c4iw_ocqp_pool_destroy(rdev);
err4: destroy_rqtpool:
c4iw_rqtpool_destroy(rdev); c4iw_rqtpool_destroy(rdev);
err3: destroy_pblpool:
c4iw_pblpool_destroy(rdev); c4iw_pblpool_destroy(rdev);
err2: destroy_resource:
c4iw_destroy_resource(&rdev->resource); c4iw_destroy_resource(&rdev->resource);
err1:
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment