Skip to content

Commit

Permalink
RDMA/bnxt_re: Use common error handling code in bnxt_qplib_alloc_dpi_…
Browse files Browse the repository at this point in the history
…tbl()

Add a jump target so that a bit of exception handling can be better reused
at the end of this function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Acked-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Markus Elfring authored and Jason Gunthorpe committed Feb 1, 2018
1 parent f390b71 commit e5b8984
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/infiniband/hw/bnxt_re/qplib_res.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,26 +705,27 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,
dpit->max = dbr_len / PAGE_SIZE;

dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL);
if (!dpit->app_tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
return -ENOMEM;
}
if (!dpit->app_tbl)
goto unmap_io;

bytes = dpit->max >> 3;
if (!bytes)
bytes = 1;

dpit->tbl = kmalloc(bytes, GFP_KERNEL);
if (!dpit->tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
kfree(dpit->app_tbl);
dpit->app_tbl = NULL;
return -ENOMEM;
goto unmap_io;
}

memset((u8 *)dpit->tbl, 0xFF, bytes);

return 0;

unmap_io:
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
return -ENOMEM;
}

/* PKEYs */
Expand Down

0 comments on commit e5b8984

Please sign in to comment.