Commit e5b89843 authored by Markus Elfring's avatar Markus Elfring Committed by Jason Gunthorpe

RDMA/bnxt_re: Use common error handling code in bnxt_qplib_alloc_dpi_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: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarDevesh Sharma <devesh.sharma@broadcom.com>
Acked-by: default avatarJonathan Toppins <jtoppins@redhat.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent f390b71b
...@@ -705,10 +705,8 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, ...@@ -705,10 +705,8 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,
dpit->max = dbr_len / PAGE_SIZE; dpit->max = dbr_len / PAGE_SIZE;
dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL); dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL);
if (!dpit->app_tbl) { if (!dpit->app_tbl)
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem); goto unmap_io;
return -ENOMEM;
}
bytes = dpit->max >> 3; bytes = dpit->max >> 3;
if (!bytes) if (!bytes)
...@@ -716,15 +714,18 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, ...@@ -716,15 +714,18 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,
dpit->tbl = kmalloc(bytes, GFP_KERNEL); dpit->tbl = kmalloc(bytes, GFP_KERNEL);
if (!dpit->tbl) { if (!dpit->tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
kfree(dpit->app_tbl); kfree(dpit->app_tbl);
dpit->app_tbl = NULL; dpit->app_tbl = NULL;
return -ENOMEM; goto unmap_io;
} }
memset((u8 *)dpit->tbl, 0xFF, bytes); memset((u8 *)dpit->tbl, 0xFF, bytes);
return 0; return 0;
unmap_io:
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
return -ENOMEM;
} }
/* PKEYs */ /* PKEYs */
......
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