diff options
| author | Christoph Jaeger <christophjaeger@linux.com> | 2014-04-21 11:02:42 -0400 |
|---|---|---|
| committer | Roland Dreier <roland@purestorage.com> | 2014-05-19 20:55:43 -0400 |
| commit | 65b302ad31b02b0790417f4e65833af494cb35ce (patch) | |
| tree | 0d190ffc41dd9dec1bb537af7eb8efaf26ddb565 | |
| parent | d6d211db37e75de2ddc3a4f979038c40df7cc79c (diff) | |
RDMA/cxgb4: Fix memory leaks in c4iw_alloc() error paths
c4iw_alloc() bails out without freeing the storage that 'devp' points to.
Picked up by Coverity - CID 1204241.
Fixes: fa658a98a2 ("RDMA/cxgb4: Use the BAR2/WC path for kernel QPs and T5 devices")
Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
| -rw-r--r-- | drivers/infiniband/hw/cxgb4/device.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c index f4fa50a609e2..8914ea90ddd9 100644 --- a/drivers/infiniband/hw/cxgb4/device.c +++ b/drivers/infiniband/hw/cxgb4/device.c | |||
| @@ -736,6 +736,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
| 736 | pci_resource_len(devp->rdev.lldi.pdev, 2)); | 736 | pci_resource_len(devp->rdev.lldi.pdev, 2)); |
| 737 | if (!devp->rdev.bar2_kva) { | 737 | if (!devp->rdev.bar2_kva) { |
| 738 | pr_err(MOD "Unable to ioremap BAR2\n"); | 738 | pr_err(MOD "Unable to ioremap BAR2\n"); |
| 739 | ib_dealloc_device(&devp->ibdev); | ||
| 739 | return ERR_PTR(-EINVAL); | 740 | return ERR_PTR(-EINVAL); |
| 740 | } | 741 | } |
| 741 | } else if (ocqp_supported(infop)) { | 742 | } else if (ocqp_supported(infop)) { |
| @@ -747,6 +748,7 @@ static struct c4iw_dev *c4iw_alloc(const struct cxgb4_lld_info *infop) | |||
| 747 | devp->rdev.lldi.vr->ocq.size); | 748 | devp->rdev.lldi.vr->ocq.size); |
| 748 | if (!devp->rdev.oc_mw_kva) { | 749 | if (!devp->rdev.oc_mw_kva) { |
| 749 | pr_err(MOD "Unable to ioremap onchip mem\n"); | 750 | pr_err(MOD "Unable to ioremap onchip mem\n"); |
| 751 | ib_dealloc_device(&devp->ibdev); | ||
| 750 | return ERR_PTR(-EINVAL); | 752 | return ERR_PTR(-EINVAL); |
| 751 | } | 753 | } |
| 752 | } | 754 | } |
