mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
RDMA/bnxt_re: Proper rollback if the ioremap fails
bnxt_qplib_alloc_dpi returns success even if ioremap fails. Add the proper rollback when the ioremap fails and return -ENOMEM status. Fixes:0ac20faf5d("RDMA/bnxt_re: Reorg the bar mapping") Fixes:360da60d6c("RDMA/bnxt_re: Enable low latency push") Link: https://patch.msgid.link/r/20260615224751.232802-11-selvin.xavier@broadcom.com Reviewed-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com> Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
dc95931b7e
commit
87267803a8
|
|
@ -764,9 +764,13 @@ int bnxt_qplib_alloc_dpi(struct bnxt_qplib_res *res,
|
|||
break;
|
||||
case BNXT_QPLIB_DPI_TYPE_WC:
|
||||
dpi->dbr = ioremap_wc(umaddr, PAGE_SIZE);
|
||||
if (!dpi->dbr)
|
||||
goto fail_ioremap;
|
||||
break;
|
||||
default:
|
||||
dpi->dbr = ioremap(umaddr, PAGE_SIZE);
|
||||
if (!dpi->dbr)
|
||||
goto fail_ioremap;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -774,6 +778,13 @@ int bnxt_qplib_alloc_dpi(struct bnxt_qplib_res *res,
|
|||
mutex_unlock(&res->dpi_tbl_lock);
|
||||
return 0;
|
||||
|
||||
fail_ioremap:
|
||||
/* Roll back the bit we just claimed. */
|
||||
set_bit(bit_num, dpit->tbl);
|
||||
dpit->app_tbl[bit_num] = NULL;
|
||||
mutex_unlock(&res->dpi_tbl_lock);
|
||||
return -ENOMEM;
|
||||
|
||||
}
|
||||
|
||||
int bnxt_qplib_dealloc_dpi(struct bnxt_qplib_res *res,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user