aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4
diff options
context:
space:
mode:
authorHariprasad S <hariprasad@chelsio.com>2016-01-12 16:33:21 +0530
committerDoug Ledford <dledford@redhat.com>2016-01-19 15:17:40 -0500
commit82b1df1b083ff1b1c45fcdf5a844351cdca03ed8 (patch)
tree16ef906b5a30522d7dda241351e99e9a56d75d81 /drivers/infiniband/hw/cxgb4
parentIB/cma: allocating too much memory in make_cma_ports() (diff)
downloadlinux-dev-82b1df1b083ff1b1c45fcdf5a844351cdca03ed8.tar.xz
linux-dev-82b1df1b083ff1b1c45fcdf5a844351cdca03ed8.zip
iw_cxgb4: Fixes static checker warning in c4iw_rdev_open()
Commit c5dfb000b904 ("iw_cxgb4: Pass qid range to user space driver") from Dec 11, 2015, leads to the following static checker warning: drivers/infiniband/hw/cxgb4/device.c:857 c4iw_rdev_open() warn: variable dereferenced before check 'rdev->status_page' Also we weren't deallocating ocqp pool in error path when failed to allocate status page. Fixing it too. Fixes: c5dfb000b904 ("iw_cxgb4: Pass qid range to user space driver") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4')
-rw-r--r--drivers/infiniband/hw/cxgb4/device.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
index bf155386a71e..2a3490fab914 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -850,14 +850,12 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
}
rdev->status_page = (struct t4_dev_status_page *)
__get_free_page(GFP_KERNEL);
+ if (!rdev->status_page)
+ goto destroy_ocqp_pool;
rdev->status_page->qp_start = rdev->lldi.vr->qp.start;
rdev->status_page->qp_size = rdev->lldi.vr->qp.size;
rdev->status_page->cq_start = rdev->lldi.vr->cq.start;
rdev->status_page->cq_size = rdev->lldi.vr->cq.size;
- if (!rdev->status_page) {
- pr_err(MOD "error allocating status page\n");
- goto err4;
- }
if (c4iw_wr_log) {
rdev->wr_log = kzalloc((1 << c4iw_wr_log_size_order) *
@@ -873,6 +871,8 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)
rdev->status_page->db_off = 0;
return 0;
+destroy_ocqp_pool:
+ c4iw_ocqp_pool_destroy(rdev);
err4:
c4iw_rqtpool_destroy(rdev);
err3: