diff options
| author | Steve Wise <swise@opengridcomputing.com> | 2007-03-26 18:48:52 -0400 |
|---|---|---|
| committer | Roland Dreier <rolandd@cisco.com> | 2007-03-26 18:54:40 -0400 |
| commit | ed6ee5178e6d78ba7f79a5ece3f0b70ece531a6a (patch) | |
| tree | a9579b737ca1b24e99f532ccd00fa0b7d30a2068 | |
| parent | e0f2e3a06be513352cb4955313ed7e55909acd84 (diff) | |
RDMA/cxgb3: Fix resource leak in cxio_hal_init_ctrl_qp()
This was spotted by the Coverity checker (CID 1554).
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
| -rw-r--r-- | drivers/infiniband/hw/cxgb3/cxio_hal.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index 818cf1aee8c7..f5e9aeec6f6e 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
| @@ -498,9 +498,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 498 | u64 sge_cmd, ctx0, ctx1; | 498 | u64 sge_cmd, ctx0, ctx1; |
| 499 | u64 base_addr; | 499 | u64 base_addr; |
| 500 | struct t3_modify_qp_wr *wqe; | 500 | struct t3_modify_qp_wr *wqe; |
| 501 | struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); | 501 | struct sk_buff *skb; |
| 502 | |||
| 503 | 502 | ||
| 503 | skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); | ||
| 504 | if (!skb) { | 504 | if (!skb) { |
| 505 | PDBG("%s alloc_skb failed\n", __FUNCTION__); | 505 | PDBG("%s alloc_skb failed\n", __FUNCTION__); |
| 506 | return -ENOMEM; | 506 | return -ENOMEM; |
| @@ -508,7 +508,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 508 | err = cxio_hal_init_ctrl_cq(rdev_p); | 508 | err = cxio_hal_init_ctrl_cq(rdev_p); |
| 509 | if (err) { | 509 | if (err) { |
| 510 | PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); | 510 | PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); |
| 511 | return err; | 511 | goto err; |
| 512 | } | 512 | } |
| 513 | rdev_p->ctrl_qp.workq = dma_alloc_coherent( | 513 | rdev_p->ctrl_qp.workq = dma_alloc_coherent( |
| 514 | &(rdev_p->rnic_info.pdev->dev), | 514 | &(rdev_p->rnic_info.pdev->dev), |
| @@ -518,7 +518,8 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 518 | GFP_KERNEL); | 518 | GFP_KERNEL); |
| 519 | if (!rdev_p->ctrl_qp.workq) { | 519 | if (!rdev_p->ctrl_qp.workq) { |
| 520 | PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); | 520 | PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); |
| 521 | return -ENOMEM; | 521 | err = -ENOMEM; |
| 522 | goto err; | ||
| 522 | } | 523 | } |
| 523 | pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, | 524 | pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, |
| 524 | rdev_p->ctrl_qp.dma_addr); | 525 | rdev_p->ctrl_qp.dma_addr); |
| @@ -556,6 +557,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 556 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); | 557 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); |
| 557 | skb->priority = CPL_PRIORITY_CONTROL; | 558 | skb->priority = CPL_PRIORITY_CONTROL; |
| 558 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); | 559 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); |
| 560 | err: | ||
| 561 | kfree_skb(skb); | ||
| 562 | return err; | ||
| 559 | } | 563 | } |
| 560 | 564 | ||
| 561 | static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) | 565 | static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) |
